Page 1 of 1
Optimizing syntax
Posted: Tue Apr 15, 2014 4:29 pm
by atout66
Hi to all,
Any idea how could I optimize this line of "bad" code :
Code: Select all
set the unicodeText of fld "lesSommaires" of card laCardDeRef of stack laStackDeRef to uniEncode (lesSommaires, "UTF8")
All the variables are OK, but LC can't compile such line it seems...
The problem occures because the script runs from a main card from where I go to another card to create fields, name them, size them and so on, and then I ask throught the script to do things in this main card; that's why I write "
of card laCardDeRef of stack laStackDeRef"
Kind regards, Jean-Paul.
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 4:34 pm
by Klaus
Bonjour Jean-Paul,
atout66 wrote:...it seems...
come on, does LC compile or not?
If not, what error do you get?
Syntax looks definitively correct!
Best
Klaus
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 4:44 pm
by atout66
Hi Klaus,
Yes, LC compile, it's during runtime it doen't find the stack...
Any way this script cause me troubbles and crash LC
I'm going to step by step debug it (534 lines !)
Kind regards, Jean-Paul.
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 4:47 pm
by Klaus
And you are sure "laStackDeRef" contains a valid stack name and that stack is open?
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 5:47 pm
by atout66
Well, I think so
I even replace them by global vars like this:
Code: Select all
put the name of this stack into gLaStackDeRef
put the name of this card into gLaCardDeRef
Both are correct.
I think I move to much from one card to another inside this script.
Anyway, the syntax is correct.
I'm going to change the way I arrange things
Thanks for your time,
Kind regards, Jean-Paul.
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 6:31 pm
by Klaus
AHA! Did you ever check the CONTENT of your variables?
Problem is "the name of this stack" and "the name of this cd", which are actually:
the name of this stack -> STACK "name of stack"
the name of this cd -> CARD "name of card"
Surely not what you (and the engine) have exspected
Use "the short name of" instead and the rest of your script will work:
Code: Select all
put the short name of this stack into gLaStackDeRef
put the short name of this card into gLaCardDeRef
Best
Klaus
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 7:01 pm
by atout66
Ah, you've got it Klaus !
It was written as a custom propertie if I understand you right. That's why in the debugger I could see "stack xxx" instead of the name of the stack only
Thanks a lot and
Kind regards, Jean-Paul.
Re: Optimizing syntax
Posted: Tue Apr 15, 2014 7:06 pm
by Klaus
atout66 wrote:It was written as a custom propertie if I understand you right.
No, the compiler does not check for VALID variables content, that's why he did not complain

Re: Optimizing syntax
Posted: Wed Apr 16, 2014 8:38 am
by atout66
Are you trying to say that the engine is more intelligent than me ?

(humour)
Re: Optimizing syntax
Posted: Wed Apr 16, 2014 11:43 am
by Klaus
Well, erm, may I call my lawyer?
