Answered

How to clear a string attribute with "set value for"

I want to clear a string attribute with an action but "set value for" doesn't accept a empty value.

I know that i can do this with a rule avec "execute a rule" but it would be better to do it with a "set value for".

Is't possible ?

photo
0

Hi,

Thank you for your answer. The problem with Refresh, as I said in a previous comment, is that Refresh reinitialize Editable / Required and Visible attribute. So i can't use Refresh

photo
0

Hi Philippe,

I don't know if you have figured this out yet.

Use case:

  1. Boolean "Done", String "Result", and date "Date"
  2. "Done" changes to false: clear "Result" and "Date" and make them not editable (or invisible ?)
  3. "Done" changes to true: make "Result" and "Date" editable (and visible ?)

Let's say your entity has 5 attributes:

  1. Done - Boolean
  2. Result - String
  3. Date - Date
  4. BlankResult - String (you could make this a process attribute) -> put in form as "hidden control"
  5. BlankDate - Date (you could make this a process attribute) -> put in form as "hidden control"

Hidden control is a type of control... I don't mean a hidden text box (As show on my 4th post)If you just use "Actions & Validations" (not the left panel with required, editable, visible):

You can create a rule

If "Done" changes to "false" Then

  • Set value for "Result" to "BlankResult"
  • Refresh "Result"
  • Set editability for "Result" to false
  • Set value for "Date" to "BlankDate"
  • Refresh "Date"
  • Set editability for "Date" to false

Else

  • Set editability for "Result" to true
  • Set editability for "Date" to true

You can also clear the values with a script which I think it is better.

photo
0

You can also put Result and Date in a container panel called Panel_Result and change your rule like this:

If "Done" changes to "false" Then

  • Set value for "Result" to "BlankResult"
  • Set value for "Date" to "BlankDate"
  • Refresh "Panel_Result"
  • Set editability for "Panel_Result" to false

Else

  • Set editability for "Panel_Result" to true

The key is to use the same rule for setting editability than for clearing.Otherwise they will be in conflict.