Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm Trying to set a triger that Clears selections in multiple fields in many places in my QV model.
Is there a way I can do this without defining a "clear field" action to each field? Maybe some kind of a concatenated string that can clear multiple fields with only one "clear field" action.
I know macro can solve this but i rather not to use it...
Thanks,
John
Is the clear button is not an option for what you are trying to do ?
As far as I know, clear button can clear one field or all fields - not multiple
folow
Hi,
with a combination of clear all and lock field you can achieve that.
Example: you have a field called myField that shouldn't be cleared.
Do as follows:
Hope this helps.
Kind regards,
Thanks Santiago,
This way I have to add an action to each field I want to lock, isn't it so? This is what I want to avoid from
Hi,
i think that you will always have to mention every field that you want to lock, but maybe this suits you better.
Then in your module you create two macros as follows:
Sub LockFields
ActiveDocument.Fields("Field1").Lock
ActiveDocument.Fields("Field2").Lock
End Sub
Sub UnLockFields
ActiveDocument.Fields("Field1").UnLock
ActiveDocument.Fields("Field2").UnLock
End Sub
Please let me know if this helps.
Kind regards,
Or maybe this one is better for you.
Create a variable with the field names to lock\unlock:
v.Fields = 'FIELD1|FIELD2|FIELD3';
Module code:
'Gets the value from specific variable passed through varName parameter
FUNCTION getVariableValue(varName)
set v = ActiveDocument.Variables(varName)
getVariableValue = v.GetContent.String
END FUNCTION
'Locks all fields in the v.Fields Variable
Sub Lock
fields =split( getVariableValue("v.Fields"),"|")
for each field in fields
ActiveDocument.Fields(field).Lock
next
End Sub
'UnLocks all fields in the v.Fields Variable
Sub UnLock
fields =split( getVariableValue("v.Fields"),"|")
for each field in fields
ActiveDocument.Fields(field).Unlock
next
End Sub
This way you'll only have to change your variable.
Please let me know if this helps you solving your issue.
Kind regards,
Yes, If you don't need to use the macro than you need to add a action trigger for each field and specify all the values that need to be cleared ..
this can be annoying, i wrote a code that will only clear the fields that are selected, you can check this qvw, this also allows you to just list those fields in an island instead of repeating code.