T O P I C R E V I E W |
aplotnikov |
Posted - 06/29/2020 : 06:42:16 AM Origin: 2020b Operating System: W10Pro 1809
Exist() does not work with string arrays.
I would appreciate any helpful hint. |
15 L A T E S T R E P L I E S (Newest First) |
AKazak |
Posted - 07/03/2020 : 04:32:16 AM quote: Originally posted by nick_n
Also, https://www.originlab.com/doc/LabTalk/guide/Debugging-Tools {script} (special syntax)
Nikolay
Spasibo!
--- AK |
nick_n |
Posted - 07/02/2020 : 1:36:17 PM Also, https://www.originlab.com/doc/LabTalk/guide/Debugging-Tools {script} (special syntax)
Nikolay |
nick_n |
Posted - 07/02/2020 : 1:29:20 PM :) https://www.originlab.com/doc/LabTalk/guide/Error-Handling BR,
Nikolay |
AKazak |
Posted - 07/02/2020 : 11:51:04 AM quote: Originally posted by Chris D But, wrapping the error-causing code in {} allows the error to get swallowed and the script jumps to after the closing }.
Got it, thank you. Where does one read more about {...} wrap?
--- AK |
Chris D |
Posted - 07/02/2020 : 08:54:05 AM Akazak,
To expound on what Nick said,
sa;
causes an error if the StringArray doesn't exist, so
stringarray_exists = 1;
would never get called and the script would abort.
But, wrapping the error-causing code in {} allows the error to get swallowed and the script jumps to after the closing }. The script continues without
stringarray_exists = 1;
ever getting called.
I hope this helps.
Thanks, Chris Drozdowski Originlab Technical Support
|
nick_n |
Posted - 07/01/2020 : 2:05:20 PM Hi,
It's kind of error handling. https://www.originlab.com/doc/LabTalk/guide/Error-Handling
stringarray_exists is a variable (not function) which stays 0 in case if {...} fails. Best,
Nikolay |
AKazak |
Posted - 07/01/2020 : 12:32:02 PM Still didn't get the trick by Chris. Appreciate any details.
--- AK |
aplotnikov |
Posted - 06/30/2020 : 05:12:54 AM Hi, Chao,
Thank you very much for another nice coding trick! The problem is solved.
Regards,
Alexei |
aplotnikov |
Posted - 06/30/2020 : 04:40:27 AM quote: Originally posted by Chris D
You can try this little coding trick
Hi, Chris,
Thank you for the coding trick - it is really amusing. However it does not work in the particular case - I do not understand, why. Unfortunately I cannot check it with different Origin versions anymore.
Anyway, many thanks and
Regards,
Alexei |
aplotnikov |
Posted - 06/30/2020 : 04:31:02 AM quote: Originally posted by YimingChen
I will report it to see if we are going to improve it.
Hi, James,
thank you for your response!
Is it possible to make this type deletable as well?
Regards,
Alexei |
cpyang |
Posted - 06/29/2020 : 7:30:51 PM
if(sa.GetSize()==0/0)
type "no sa";
CP
|
AKazak |
Posted - 06/29/2020 : 4:51:26 PM quote: Originally posted by Chris D
You can try this little coding trick:
StringArray sa;
int stringarray_exists = 0;
{
sa; // Change me to a non-existant StringArray name to test
stringarray_exists = 1;
}
stringarray_exists=;
Thanks, Chris Drozdowski Originlab Technical Support
Hm. Is stringarray_exists a function returning int? Why non-existing sa; will prevent stringarray_exists = 1; ?
--- AK |
YimingChen |
Posted - 06/29/2020 : 09:49:19 AM Nice trick!
quote: Originally posted by Chris D
You can try this little coding trick:
StringArray sa;
int stringarray_exists = 0;
{
sa; // Change me to a non-existant StringArray name to test
stringarray_exists = 1;
}
stringarray_exists=;
Thanks, Chris Drozdowski Originlab Technical Support
|
Chris D |
Posted - 06/29/2020 : 09:39:55 AM You can try this little coding trick:
StringArray sa;
int stringarray_exists = 0;
{
sa; // Change me to a non-existant StringArray name to test
stringarray_exists = 1;
}
stringarray_exists=;
Thanks, Chris Drozdowski Originlab Technical Support
|
YimingChen |
Posted - 06/29/2020 : 09:37:54 AM Hi,
Exist() function doesn't search StringArray according to: https://www.originlab.com/doc/LabTalk/ref/Exist-func
I will report it to see if we are going to improve it.
James |