Choose Language Hide Translation Bar
Highlighted

## Populate column with oldest date of a part number set

Hi,

I want to populate a column called “First date” with the oldest date of all the rows with the same part number.

I have a table that has three columns: part number, PO date, First date. The table is sorted by part number.

I’m hoping someone can modify my code to make it work. I think I’m kind of close and this would really help me learn if I can follow the script.

SmPrt="False";

For(i=1,i<=nrows(),i+=1,

if(SmPrt="False",

FrstDt=PO date(i)

);

if(:Part number(i) == :part number(i-1),

SmPrt = "True", smPrt= "False"

);

if(SmPrt == "True",

if(:PO date(i)< :PO date(i-1),

FrstDt= :PO date(i)

)

);

if(smPrt = "False", :First date(i)=FrstDt);

);

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Populate column with oldest date of a part number set

If I understand correctly your issue, you may not need to use a script to achieve your goal.

Assuming that your "First Date" variable is numeric and continuous (not stored as text), you could use the Column Minimum formula with a "By" "Part Number" filter as shown below.

Col Minimum( :First Date, :Part Number )

Let me know if that meets your requirements.

Best,

TS

Thierry R. Sornasse
Highlighted

## Re: Populate column with oldest date of a part number set

If I understand correctly your issue, you may not need to use a script to achieve your goal.

Assuming that your "First Date" variable is numeric and continuous (not stored as text), you could use the Column Minimum formula with a "By" "Part Number" filter as shown below.

Col Minimum( :First Date, :Part Number )

Let me know if that meets your requirements.

Best,

TS

Thierry R. Sornasse
Article Labels

There are no labels assigned to this post.