Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
pmaxx0108
Contributor
Contributor

How to load fields with '*_ID'

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;

 

 

1 Solution

Accepted Solutions
Saravanan_Desingh

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;

View solution in original post

2 Replies
Saravanan_Desingh

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;
pmaxx0108
Contributor
Contributor
Author

Thank you!