Skip to main content

Hi All,

 

Can anyone explain the rules for when the conditional styles are applied to fields?

 

I have a form where I'm trying to highlight a field based upon data brought back in a smart object.  The field is located on a view, itself embedded in a tab on the form.  The view is loaded with data when the tab is selected.  On initial tab selection, the style is rendered correctly, however if you then change tab and then go back to the first one, the style applied to the field no longer appears to be being based on the smart object data (which is refreshed) but remains as it was when the tab was first selected...???

 

In brief steps...

 

1. Tab selected
- Smart object data for view read and shown
- Conditional style based upon SMO data correctly applied...

2. Change tab

 

3. Go back to tab identified in step 1
- Smart object data for view read and shown (it's since changed)
- Conditional style (based upon smart object data) not applied ...?

 

Thanks,

 

Paul.

Hmm... I'm kinda confused in your third step where you go back to the first tab and you mentioned the smartobject data changed? Could you provide more details on that? 


 


Oh and also, which version of K2 are you running on?


Running with 4.7.

 

Hopefully this explanation helps as I'm just about to run for a train...

 

So when the tab is selected, it's set to execute a read against the linked smartobject data. Conversely, when the tab is deselected it saves the data shown in the views assigned to the tab.  (This is to reduce the amount of data that is saved at any single point)

 

This smart object data is mapped to the form fields and shows correctly i.e. when you go back to the tab it reloads the data and shows any updates fine but the conditional styles do not seem to re-evaluate.

 

In the example that we have we're trying to identify fields that have changed across versions of a document.  The smart object surfaces a flag that indicates a field difference and using an conditional style expression based this property a border surrounding the field is applied or not.  On first load, if the flag is set the border is applied correctly but then if the field is reset back to it's original setting and the tab deselect (the data is saved) when the tab is selected again it should show the field without the border highlighting any change (The smart object correctly retrieves the field indicating no-changes on the second tab selection).  In our simple test this doesn't happen and the conditional style remains applied?

 

Cheers,

 

Paul.


 


Ok, so am I right to say that the conditional style for that particular textbox control has a rule like:


 


If flag is true, apply border


 


If the above is correct, this might sound silly but have you checked if the flag value still remains the same after it reloads the data? thus causing the conditional style to still be applied?


 


From what I know, the conditional style is "constantly" evalauated where any changes made to the arguments of the condition that changes the result would reflect pretty much instantaneuously.


 


 


That's exactly correct, (if flag is true then add 1px border to field).

 

Initially I'd checked the smartobject manually through the tester to confirm that it was returning what I expected - which it was, however just to confirm I hadn't missed anything I added the the flag to the form too to it visible in the UI.  Surprisingly, this caused the evaluation to start firing continuously as you say which is a shame as I'd prefer to keep the controls to a minimum on the form state as it just increases it's size and increases form bloat (especially when repeated for each field in a complex form)

 

Do you know if this is expected behavior? I would have thought that the rule would have needed to be configured explicitly against the field rather than the smart object for this to occur. It seems to be that if the smartobject field isn't bound to a control then any changes are ignored?

 

Cheers for the discussion!

 

Paul.


Hmm... interesting, I did manage to get a similar behaviour where it doesn't refresh as you described once I took away the control that displayed the flag's value. It might be by design for all I know, you'd probably need to contact your region's support to have this investigated thoroughly. 


 


But here's something you can try if you haven't already, your mileage may vary though. I'm also assuming that you're using an Item View bound to the smartobject, and you have a rule like the following on the form:


 


When Item View Tab is Selected,


- then on Item View, execute the Load method


 


In which case you could try adding Item View Clear action before the Load just to clear the "cached" value on the Item View, so that it reloads anew:


 


When Item View Tab is Selected,


- then complete the following one after another


-- then on Item View, execute the Clear method <-- Add this in


-- then on Item View, execute the Load method


 


I've tried the "clear" action but that doesn't have any impact on the re-evaluation of the conditional style.  It appears that it will only re-evaluate if the SMO field is bound to a control.

 

I'l raise the issue with the support team and see what they say but once again thanks for the suggestions.

 

Best regards,

 

Paul.


Reply