Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
xyz_1011
Partner - Creator II
Partner - Creator II

Parse text (RegEx ParseAll ?)

Hi all,

i have a regular Qlik script file. Among other script content, the script also includes multiple $(Must_Includes) statements.

Within one of my automations, i am receiving this file and i managed to get to its content (basically a long string). From this string I want to

  1. extract all occurances of include statements in a given file and and create a list of include statements - i.e., like this:  $(Must_Include=$(vModulesRoot)SALES\Revenue.qvs);, $(Must_Include=$(vModulesRoot)SALES\Customer.qvs);
    Would i be able to do this with a regex() ? Or any other way in an automation ?
  2. Once i have extracted all includes and build a list of them, i would like to loop over this list of include statements and
    1.  get the filename (following the above example: Revenue.qvs and Customer.qvs) of every include statement and
    2. next to it: also the directory (following the above example: SALES)

Any advise on how to get there wohld be greatly apreciated!

Thanks in advance!

Labels (1)
  • SaaS

13 Replies
xyz_1011
Partner - Creator II
Partner - Creator II
Author

Got it done myself. Thanks.

AfeefaTk
Support
Support

Hi @xyz_1011 

Based on your recent query:

Regarding to the accepted solution in my post, i realized, that ideally i not only need the includes() extracted and parsed, but also every call StoreIntoSDL() line following the include. Is it possible that the custom code segment gives me two variables:

1. the extracted and parsed include()

2. the call StoreIntoSDL line that comes after ?

Meaning, given this script piece:

$(Must_Include=$(vModulesRoot)03_SALES\MOD_Revenue.qvs);
call StoreIntoSDL ('MOD', 'Revenue', '03_SALES', 'Revenue');

I would like to get the following items back from the custom code block:

vInclude = 30_SALES\MOD_Revenue.qvs (<-- that works already in your solution)

vStore = call StoreIntoSDL ('MOD', 'Revenue', '03_SALES', 'Revenue'); (<-- this would need to come on top)

I am attaching automation json for your reference.

Hope this works!!

Thanks

xyz_1011
Partner - Creator II
Partner - Creator II
Author

Thanks, @AfeefaTk  - this does al,most what i need. However, i am not able to process the output of each iteration together. Meaning: In the first loop i expect to receive the first parsed include() and the first extracted call() then i do something with this output. In the second iteration the secon parsed include() together with the second call(), then i do something with this output ... Hope, this makes sense. Thanks again!

 

AfeefaTk
Support
Support

Hi @xyz_1011 

Please find the attached automation

Thanks