Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have resident table 'Orders' with:
Customer _ID,Order_ID,Shipment_ID,CustomerName,Date,Product ..etc
How I can load distinct *_ID fields only?
Table_s:
LOAD DISTINCT
*_ID /// I need all fields with _ID
Resident Orders;
Try like this.
tab1:
LOAD * INLINE [
Customer _ID,Order_ID,Shipment_ID,CustomerName,Date,Product
1,2,3,4,5,6
];
Set vFields='';
FOR i = 1 to NoOfFields('tab1')
LET vFieldName = FieldName($(i),'tab1');
If '$(vFieldName)' Like '*_ID' Then
Trace ***Inside;
Let vFields = '$(vFields),$(vFieldName)';
EndIf
NEXT i
Let vFields=Mid('$(vFields)',2);
tab2:
LOAD Distinct '$(vFields)'
Resident tab1;
Try like this.
tab1:
LOAD * INLINE [
Customer _ID,Order_ID,Shipment_ID,CustomerName,Date,Product
1,2,3,4,5,6
];
Set vFields='';
FOR i = 1 to NoOfFields('tab1')
LET vFieldName = FieldName($(i),'tab1');
If '$(vFieldName)' Like '*_ID' Then
Trace ***Inside;
Let vFields = '$(vFields),$(vFieldName)';
EndIf
NEXT i
Let vFields=Mid('$(vFields)',2);
tab2:
LOAD Distinct '$(vFields)'
Resident tab1;
Thank you!