Dear jsl scripters,
I have a script in which I use the include instruction to call a subscript for "reporting" (inserting a JMP chart into a powerpoint file):
dt = Current Data Table();
Include( strRootPathScript || str_report_Product1) );
It works fine as long as I use 1 product. My wish is to loop on a liste of products [Product1;Product2;...]
and to replace the product name into the include instruction.
After some exotic trials around the EVAL/EXPR/SUBSTITUTE instructions, I am begging your help!
Thanks!!!
Jerome
Hi @J_Bonnouvrier1 ,
It's a little hard to generalize this to work under any circumstance, but you could loop through it given a code/file structure as I imagine it.
Assuming that you know before hand the substitutions Product1, Product2, etc In your JSL code, if you do something like:
dt = Current Data Table();
For(i=1, i<=NItems(Product_List), i++,
Include(strRootPathScript||"str_report_"||Product_List[i]);
);
In this case, the variable Product_List would be a list of your products: Product_List={"Product1", "Product2", "Product3",...};. In the For loop, when it calls Product_List[i], it would be concatenating the ith element of Product_List. So, if i = 3, it should do the following:
Include(strRootPathScript||str_report_||Product_List[3]) , where I'm assuming strRootPathScript is some root path, like "C:\myfiles\JSL_code\", so that the argument you're feeding into the Include function would in this case be: "C:\myfiles\JSL_code\str_report_Product3".
Is this kind of what you're after?
Hope this helps!,
DS
Hi @SDF1 ,
Actually I forgot to mention that str_report_Product1 is a variable giving the name of the file for each product:
str_report_Product1 = "C:\temp\report_Product1.jsl"
So, the solution you propose is not recognized by the script.
Thanks and regards,
Jérôme