Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I want to use a variable in my script but it doesn't work.
First, I created a simple table with one field called 'site' which contains 3 values: value1, value2 and value3
After, I created a variable in my script and I want to have the selected value (value1 or value2 or value3) in it:
LET myvariable = peek('site');
This expression doesn't work, 'myvariable' don't contains a correct value :
SQL SELECT champ FROM $(myvariable).table1 ;
Thanks for your help !
Are you selecting the 'value' to pass to the variable in the script or a front end table object?
Via the front-end you'll have to associate it with a variable that remains persistent after the reload has been initiated, conversley within the script you need to tell the variable which is the correct record eg:
Let vMyVariable = peek('MyData',-1,'site');
The above would select the bottom record from the previously loaded table 'MyData'.
Perhaps posting an example file would help matters.
All the best,
Matt - Visual Analytics Ltd
If you are using peek outside of the table itself, you have to specify a table name.
Thanks for your answers ! but I want the last selected value in my table and not the first or the last.
I want to do this :
1) I select a value in my table
2) The value goes to the script and the script is loaded
It's possible ?
Thanks.
Thanks for your answers ! but I want the last selected value in my table and not the first or the last.
I want to do this :
1) I select a value in my table
2) The value goes to the script and the script is loaded
It's possible ?
Thanks.
This will take some trial and error but should be doable. Create a macro like the one below (off the top of my head so syntax will probably be off)
Function passVar (strVar)
passVar = ActiveDocument.Variables(chr(34) & strVar & chr(34).GetContent.String
End Function
Then in your script use passVar(VariableName)
Might want to try something like
SET vSomething = passVar(VariableName)
I've never done this before quite like this but I don't see why it wouldn't work. I'm not 100% sure about the chr(34) part but I think it's fine (try it in a msg box I guess)
Actually you should just use like the statement below instead of ActiveDocument.Variables(chr(34) & strVar & chr(34).GetContent.String ...
ActiveDocument.GetFieldSelections("fieldname").text
or something like that I don't know the actual syntax off the top of my head so I'm almost certain it's wrong but if you look in the API guide it should be easy to figure out