Author |
Topic  |
|
peter.cook
UK
356 Posts |
Posted - 02/05/2003 : 06:48:42 AM
|
Hi,
Can anyone help/clarify?
I'm trying to input 3 strings via a dialog using getn and have either come across a quirk/minor bug or don't exactly understand what's going on...
The code I would expect to work is:
Create CompoundID -s 3; %T=""; %U=""; %V=""; Getn (Compound ID 1) %%T (Compound ID 2) %%U (Compound ID 3) %%V (Enter Compound IDs);
// Use variables CompoundID[1]$="%T"; CompoundID[2]$="%U"; CompoundID[3]$="%V"; %Z="%T"; If(%U!=""&&%U!=" ") %Z="%Z %U"; If(%V!=""&&%V!=" ") %Z="%Z %V"; SRDataPlot!compoundid.text$=" %Z"; // Keep text is not "";
This however displays " T", " U" & " V" in the dialog box. If I don't later the values & click OK then %T,%U,%V = "".
Create CompoundID -s 3; %T=" "; %U=" "; %V=" "; Getn (Compound ID 1) %%T (Compound ID 2) %%U (Compound ID 3) %%V (Enter Compound IDs); seems to work OK and keeps the space but I would then have to do something like if(%T==" ") %T="";
%T=""; %U=""; %V=""; Getn (Compound ID 1) %T (Compound ID 2) %U (Compound ID 3) %V (Enter Compound IDs); displays only entries for 1st and second dialog (but no space as expected) - I then can't read these values eg %T="...".
Cheers,
Pete
|
|
Mike Buess
USA
3037 Posts |
Posted - 02/05/2003 : 07:56:41 AM
|
Hi Pete,
I agree that getn handles empty string variables awkwardly and have found that it's most reliable to start with a default value...
%T="001"; %U="002"; %V="003"; Getn (Compound ID 1) %%T (Compound ID 2) %%U (Compound ID 3) %%V (Enter Compound IDs);
That way (1) you know what will show up in the dialog and (2) the return value can be used as it was entered.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 02/05/2003 08:09:33 AM |
 |
|
peter.cook
UK
356 Posts |
Posted - 02/05/2003 : 10:35:12 AM
|
Hi Mike,
That does seem to be the case, in which case (Originlab) I'd call it a minor bug.. I agree default values makes it more reliable but not ideal for the user in some cases..
Thanks for reply,
Cheers,
Pete
|
 |
|
|
Topic  |
|
|
|