Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Any advise on how to get there wohld be greatly apreciated!
Thanks in advance!
Hi @xyz_1011
I have tried this using custom code block.
Please take a look at the json file and let me know if that works for you.
Thanks
Hi @xyz_1011
Let me try to understand the workflow.
So you are getting the script content using the Get Load Script block and want to get all the include statements from the script, add them to the list and loop over this list, get the filename and folder name from each item.
Do you have the automation on which you are working?
Thanks
Hey @AfeefaTk - i believe outlining the whole use case would be something for a dedicated call (which I'd be happy to jump on if you like 🙂 ) rather than this forum post. What i am after is part of a complex use case. But let me try to illustrate with the attached (simplified) example automation as well as the following example description:
I hope, what i am after became a bit clearer...in essence, what i am struggling with is: Extract the substring from every include and then iterate over every extraction.
Thanks a lot upfron!
Im far from a regexp expert but rather good a googling 🙂 so what about apply a regExp parse all function on the string:
(?<=Must_Include=)(.*)(?=;)
I tested it with some examples in a variable (vString) with the output block with the following code (formula parsing off):
{regexparseall: {$.vString}, '(?<=Must_Include=)(.*)(?=;)'}
The output will not include Must_Include and the semi-colon, the regExp takes the string between these two strings. It also includes a ) at the end as the regexp fails if I use ); instead of ; as the end-string.
Hi @xyz_1011
This formula works
{regexparseall: {$.vString}, '(?<=Must_Include=)(.*)(?=;)'}
But you also need to remove this $(vModulesRoot) from the path right?
Hi @xyz_1011
I have tried this using custom code block.
Please take a look at the json file and let me know if that works for you.
Thanks
Hey @AfeefaTk Very elegant! I had no clue that there is a way to work with PHP. This is cool!
(obviously, it also does the job 😉 Thanks!!)
Hi @xyz_1011
I would suggest you try my recent automation which uses the regex formula by replacing the custom code block. This should be a more clean solution than the custom code one.
Thanks
Hey @AfeefaTk thanks again for your help. I am running into an issue though, when trying to get a file from my repo after parsing the includes:
1. storing every extracted & parsed include ina variable:
2. trying to get a file from my repo using this variable:
3. Runn ing into this error, where the / seems to cannot be decoded properly:
Any idea how to solve this ?