Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there!
I would like to do the following:
When the user makes a selection in a particular field I would like about 30 variables to be updated with the result of an only-statement including some set analysis. I am aware that this can be done by using the set variable functionality under field actions -> external actions 30 times, but this is a bit messy in my opinion.
So, can it be achieved using a macro? Abusing notation a bit, I would like to have 30 statements like:
LET var_i = only({$<A={"B_i"}>} Field)
I know that macros can set variables, so it is primarily the only-part with the set analysis I am wondering about.
Hi,
This is the macro that you need:
sub setVariables()
dim i
for i=1 to 30
ActiveDocument.CreateVariable "var_" & i
'if your variables already exist, you dont need the line above
set v = ActiveDocument.GetVariable("var_" & i)
v.SetContent "only({$<A={B_" & i & "}>} Field)",true
next
end sub
You can call it from Actions -> External -> Run Macro
Hope this helps,
Erich
Hi,
This is the macro that you need:
sub setVariables()
dim i
for i=1 to 30
ActiveDocument.CreateVariable "var_" & i
'if your variables already exist, you dont need the line above
set v = ActiveDocument.GetVariable("var_" & i)
v.SetContent "only({$<A={B_" & i & "}>} Field)",true
next
end sub
You can call it from Actions -> External -> Run Macro
Hope this helps,
Erich
Hey, you're right! Thanks!