Page 1 of 1

include + string var.

Posted: Mon May 16, 2011 1:17 am
by ferdy_adam
Hi
I wanted to write the following line in a program:

%typ="Ndc2_11"
include "creationmodux2010_{%typ}.prg"

Why would that not work? Is there an way to run different programs according to the value of a string variable?
Thank you very much for your kind help

Yours sincerely

Ferdy Adam

Re: include + string var.

Posted: Mon May 16, 2011 3:08 am
by trubador
Have you tried the following?:

Code: Select all

%typ="Ndc2_11" exec creationmodux2010_{%typ}

Re: include + string var.

Posted: Mon May 16, 2011 3:54 am
by ferdy_adam
thanks for that suggestion
i'm not used to usind the exec command
your suggestion actually does not work but this works:
%typ="g:\data\adam\modux\archivesModeles\prevision\Prevision2010\programs\lecturetransfdonnees2010_Ndc2_11.prg"
exec {%typ}
hence i have to specify to whole path but i can construct it from different string elements, which is what i wanted to do.
best regards
ferdy