View parameter not changed until after root startup script runs

Hi,

I set up a view with a custom parameter. The custom parameter will control whether a particular text input box is displayed. During the root startup script of that view, I set the focus based on that custom parameter, but it seemed like the parameter wasn't getting set until after the view ran. So I put a change script on the parameter, and sure enough, it changes just after that root startup script runs.

I am using a system.perspective.navigate to navigate to the view, with the payload setting the custom parameter.

Is that expected? It seems like the parameter should be available from the moment the view is navigated to, so all startup scripts would be able to know how the parameter was set.

I can post more detail if anyone needs it.

Thanks

i think this is expected behaviour and just how perspective pages and views are loaded. Everything loads asynchronously. Try your focus script on a value change script on the param itself.

It would be good if there was a note added to the startup script description to indicate this...

OK, I see, it's a side effect of everything being asynchronous. But somewhat defeats the purpose of having startup scripts.

I was able to work around it in the manner you suggested. Thanks for the help

Ken

Startup Scripts are the very first thing Views/Components do and are intended to be used as a way of notifying any observers that a View/Component (item) has started, rather than providing insight into the item itself. Session Startup scripts function in a similar manner: projects which require authentication will notice that the session starts before a user has even logged in, and so references to that property are often troublesome within these scripts.

In the context of Views/Components, you'll notice that even bindings have not yet resolved, and so references to those will provide unexpected values.

1 Like