Subscribe Bookmark RSS Feed

JSL: how can I get a "pathfinder"?

uwe_hiss

Community Trekker

Joined:

Aug 12, 2015

Hi,

with following script I would like  to create a "pathfinder" with variables (choosen items from List Box).

What am I doing wrong?

spath = "R:\00 DnA\2015\";

// or npath = "nasdlkxxx\AB1_FileShare06\wpa001\00 DnA\2015\" 

Tpm = {

  Famar,

  Gnosis,

  Hospira,

  LabBio

  };

   

FamarSUB = {

  Brufen P278,

  Brufen P280,

  Brufen N950,

  Clari 3368,

  Clari 10061,

  Clari G656,

  Clari L214,

  Clari L950,

  SAMe N309 G,

  SAMe N309 TB,

  SAMe N917 G

  };

    

GnosisSUB = {

  SAMe 16373 S4,

  SAMe 24358 S7,

  SAMe 53570 S21

  };

    

HospiraSUB = {

  SAMe N309,

  SAMe N917,

  SAMe P332

  };

LabBioSUB = {

  SAMe N309 G,

  SAMe N309 TB,

  SAMe N917 G

  };

    

tpar = Associative Array( Tpm, {FamarSUB, GnosisSUB, HospiraSUB, LabBioSUB} );

New Window( "Select TPM AND Product", << Modal,

     V List Box(

           Text Box( "Select TPM" ),

           tpmbox = List Box(Tpm,

  prodbox << remove all;

  prodbox << append(

                            Eval ( tpar[Parse( (tpmbox << get selected)[1] )] ));

                            ctpm = tpmbox << get selected;

                            ),

           Text Box( "Select Product"),

           prodbox = List Box ({}),

           Button Box( "OK", cpro = prodbox << get selected ),

     )

);

data_path = spath||ctpm||"\"||cpro||"\Database";

data_file= Pick File("Select data base");

dt_data= Open(data_path||data_file, invisible);

spec_path = spath||ctpm||"\"||cpro||"\Misc\Specs";

spec_file= Pick File("Select spec file");

dt_spec= Open(spec_path||spec_file, invisible);

Thank you in advance,

Uwe

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The selected items from a list box form a list - even if there is only one selection.  So in your code "ctpm" and "cpro" are lists and so the string concatenation fails when you construct the data_path variable.  You need something like:

selectedTpm = ctpm[1];

selectedPro = cpro[1];

data_path = spath || selectedTpm || "\" || selectedPro || "\Database";

and


spec_path = spath || selectedTpm || "\" || selectedPro ||"\Misc\Specs";

-Dave
1 REPLY
Solution

The selected items from a list box form a list - even if there is only one selection.  So in your code "ctpm" and "cpro" are lists and so the string concatenation fails when you construct the data_path variable.  You need something like:

selectedTpm = ctpm[1];

selectedPro = cpro[1];

data_path = spath || selectedTpm || "\" || selectedPro || "\Database";

and


spec_path = spath || selectedTpm || "\" || selectedPro ||"\Misc\Specs";

-Dave