Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
seWork
Contributor III
Contributor III

Peek Keyfield Value based on 2 Fields

Hi all,

I'm trying to peek a value as part of loop script(For i = 1 to X)

The script should be based on 2 fields from an existing table

-Date

-Category

so the script will peek and line based on field "Keyfield" as many times as set by these two parameters in the "Secondary table"

(The Keyfield will be duplicate and then i will join the rest of fields by left join)

after this part will be done I would like to replace the Part_ID value in the New table based on random peeking Part_ID form the same category(And to change the Keyfield value to a new value by using "'FE-'&Keyfield as Keyfield"   in order to keep each value unique)

and to concatenate the "new table" with the "source table"

There are any suggestions on what will be the best way to execute it?

Thank you

2 Replies
seWork
Contributor III
Contributor III
Author

I don't know why but I did not succeed to post the tables structure as I see it

(You'll find it in the attached text file)

seWork
Contributor III
Contributor III
Author

I tried to begin to solve it it by running the following script but I'm getting an error

Table not found error

Table 'TempOrderLines' not found

store TempOrderLines into OrderLinesGen/TempOrderLines0.QVD


(At the moment im running the script for the Date only)

Order_Dates:

Load Distinct Date Resident OrderHeader;

Let QyDate = FieldValuecount(FieldName(1,'Order_Dates'));

MinDate:

Load Distinct MIN(Date) as Mindate Resident Order_Dates;

Let vMinDate = Peek('Mindate',-1,'MinDate');

Drop table Order_Dates;

Drop TABLE MinDate;

For gDate = 0 to QyDate

TempOrderLines:

First (10)

Load * Resident Order_line

where Date=date($(vMinDate)+$(gDate));

store TempOrderLines into OrderLinesGen/TempOrderLines$(gDate).QVD;

Next gDate;