Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Load only fields with specific prefix

Is there any (automated) way of doing a load of fields with specific prefixes. I have a table (example Table A below) that is constantly modified and rather than have to add and removes fields every time it would be great screen the fields (as an example in Table B below where it would automatically only pull in fields beginning with MI):

For example:

Table A:

Load

MI Customer,

MI Region ,

MI Amount,

Sales,

Employee,

Budget

From Table_Source;

Table B:

Load

{only fields beginning in MI}

Resident Table A:

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Yes, that's possible.

[Table A]:

LOAD * INLINE [

MI One, MI Two, MI Three, Four, Five

1,2,3,4,5

];

LET vFields = NoOfFields('Table A');

For j=1 to $(vFields)

    LET vField = FieldName($(j),'Table A');

    WHEN FindOneOf('$(vField)','MI') LET vFieldList = '$(vFieldList)' & ', ' & '[$(vField)]';

next

LET vFieldList = Mid('$(vFieldList)',2);

[Table B]:

LOAD

     $(vFieldList) 

RESIDENT

     [Table A]

;

SET vFieldList=;


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Yes, that's possible.

[Table A]:

LOAD * INLINE [

MI One, MI Two, MI Three, Four, Five

1,2,3,4,5

];

LET vFields = NoOfFields('Table A');

For j=1 to $(vFields)

    LET vField = FieldName($(j),'Table A');

    WHEN FindOneOf('$(vField)','MI') LET vFieldList = '$(vFieldList)' & ', ' & '[$(vField)]';

next

LET vFieldList = Mid('$(vFieldList)',2);

[Table B]:

LOAD

     $(vFieldList) 

RESIDENT

     [Table A]

;

SET vFieldList=;


talk is cheap, supply exceeds demand
zagzebski
Creator
Creator
Author

Thanks!!