Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
You can set a action on a field at the triggers in documents settings for example by selecting.
When the field is lost after executing script by an error, the action is lost, too.
Is there a way to set the actions in the script?
Regards
You lost me on this one. If the field is lost due to an error during a reload, the action won't work no matter where it iss, as the field is lost. Are you just looking to not lose the action, in general, so when you recover the field the action can be used? That sounds like a possible bug. What version of QV are you using and where is the action being lost? IS it on the Access Point, Ajax, or the .QVW file?
More info please...
Nate
Hi,
I reproduced the problem on QV 11 SR1.
If in any reload you lose the field with the trigger, it will be lost even when you recover the field.
It is not possible to recreate it on script. Maybe you could write a macro with some effort to recreate the trigger but it would be a problem to use it. I'd suggest you call this macro on post reload method, but this event is not triggered on server reload...
Then, I'd say it is a bug...
Regards,
Erich
An interesting thread. A couple comments.
1) You can't define the Actions with a macro, as there is no API to define Actions.
2) When I get a script error, I click Cancel and reload the old content. Some people click Cancel and press on. This issue - lost Actions -- would appear to be a side effect of clicking OK.
-Rob
I would also register this bug with QlikTech. I would think that a document "property" should be saved, and not lost, even on a field loss. When you lose a field that is a dimension in a chart, it get the red line, and is not removed. I would think the same behavior should be expected throughout the application.
Hi, Rob.
There should be methods to manage actions...
If the code used Load * from or Select * the script could finish without erros killing the actions.
We also need to be careful with 'Exit script' in the middle of the code to test parts of the script because we can potentially lose the actions.
Regards,
Erich
I'm guessing that there are 1 of 2 things happening to Martin.
1. Martin is still building the app and the load fails, just as a part of the Dev process. The action was in, and now he lost it on the last failure. (We've all been there!)
2. Someone is making unanounced changes to the underlying data structure and causing the failures from QVS.
I'm guessing that scenario 1 is what is happening.
Nate
Hello @ all.
Thanks for your suggestions.
The workaround to cancel the script and reload the previous version may working while developing with the client.
If this happens at the reloadjob because a file is corruped or missing you can't stop saving the file with the missing field.
Another workaround I'm thinking about:
load the action fields with an inline load without datas at the beginning so the field will be saved and also the actions.
Regards
It's a very poor behaviour, and I would expect these settings to be persisted. Has anyone raised it as a bug (or after you have been told it is "by design", an idea)?
I have just added a dummy table to the start of my load script to ensure these fields always exist - it seems to be working fine for me (when the script errors, or if I use an Exit Script statement during debugging).
Further to earlier posts, it IS possible to create and amend field triggers via macro, but not yet sure if all options are covered.
The following code from APIGuide reads the triggers as set up ...
set fld=ActiveDocument.GetField("Customer")
set fp = fld.GetProperties
set actions=fp.OnLockActionItems
for i=0 to actions.Count-1
msgbox "Action types: " & actions.item(i).Type
next
.. by amending this slightly I have managed to change the order of the actions and add a new one ...
set fld=ActiveDocument.GetField("timeTrigger")
set fp = fld.GetProperties
set actions=fp.OnLockActionItems
msgbox "Action types: " & actions.item(0).Type 'Originally set up as activate next sheet
msgbox "Action types: " & actions.item(1).Type 'Originally set up as activate previous sheet
actions.item(0).Type = 10 'Activate previous sheet
actions.item(1).Type = 9 'Activate next sheet
actions.add
actions.item(2).Type = 10 'New action
fld.SetProperties fp
... might be useful to someone.
flipside