DeanRavenscroft
Contributor
Contributor

Is it possible to prevent a form Presentation action from calling another input action until the first has data?

Jump to solution

Hi all,

I had always assumed that setting Data Binding and using GetAction OGNL would by default follow an order based on the other inputs used in ".call".

It appears this is not the case at all and it will run the actions whether there is data in the other inputs or not. I noticed this when I set up some logging to find a bottleneck and it showed the actions running multiple times with only the final run producing usable data.

(Note that the below is just an example of one of the instances I am seeing it, its not specific to this use case)

For example;

GetAction("com.example","getCurrentTags_Friendly").call( #virtualMachine , #policyList )

I notice in the logs that this will run multiple times, presenting the data in #policyList as "null" until the action populating #policyList input has completed. This was slowing the overall form down considerably until I added "if (virtualMachine && policyList ) {" to the top of the action, but this only speeds up the action itself, it doesn't prevent it from being called in the first place.

I have tried multiple methods to get it to wait, but all ultimately still show the action being called.

1) I have tried setting Hide or Show parameter input based on the content of "#policyList" and while the field is hidden in the form, logs show that the actions still ran.

2) I have set "#currentVmTags = #policyList != null ? GetAction("com.example","getCurrentTags_Friendly").call( #virtualMachine , #policyList ):null" but the action still runs rather than returning "null" as hoped.

I was hoping someone here can advise of if there is an alternate method I am not aware of to somehow run it in a specific order without wasting time repeating actions.

Cheers


Dean

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee

Hi,

As far as I know, there is no way to control the evaluation of presentation fields' properties; the evaluation logic is hard-coded inside presentation service and cannot be changed without re-compilation of vRO client code..

View solution in original post

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee

Hi,

As far as I know, there is no way to control the evaluation of presentation fields' properties; the evaluation logic is hard-coded inside presentation service and cannot be changed without re-compilation of vRO client code..

0 Kudos
DeanRavenscroft
Contributor
Contributor

Ah damn. No worries, thanks Illian.

I will just make sure the actions will skip any processing until the correct data exists.

Cheers


Dean

0 Kudos
stevedrummond
Hot Shot
Hot Shot

Hey Dean,

You can prevent the action from running using OGNL but you cannot prevent the presentation OGNL from being processed (as Illian responded).

In your example where you said you tried using a ternary operation of #policyAction != null ? <action> : null but it still ran the action, did you actually check what the value of #policyAction is? It could be undefined, an empty string, an empty array, etc. None of those are null.

You can definitely do it, as it is how I make the majority of my presentation fields. However I would always suggest having logic in your action code that also verifies the inputs in the event someone does not include the check in OGNL or if the OGNL starts becoming messing.

0 Kudos