AnsweredAssumed Answered

SET A FIELD - CONDITIONAL TO FIELDS IN A PORTAL (Test all Rows)

Question asked by rickmerl on Jun 26, 2017
Latest reply on Jun 28, 2017 by user19752

SET A FIELD - CONDITIONAL TO FIELDS IN A PORTAL (Test all Rows)

 

I have a portal with 6 fields per portal row. The fields are organised as 3 pairs

Pair1 - Field_A1 (text)    Field_A2 (date)     Field_A2  Placeholder text  when empty = “Insert Date”

Pair2 - Field_B1 (text)    Field_B2 (date)     Field_B2  Placeholder text  when empty = “Insert Date”

Pair3 - Field_C1 (text)    Field_C2 (date)     Field_C2  Placeholder text  when empty = “Insert Date”

 

I have a single field on my main database page called:

ABC_Indicator (text)

 

I want to set ‘ABC_Indicator’ to “X”, when the following conditions are met:

When  Field_A1 is not empty, and  Field_A2 is empty

and/or Field_A1 is not empty, and  Field_A2 is empty

and/or Field_A1 is not empty, and  Field_A2 is empty

(Where any one (or more) of the date fields  (..A2, ..B2, ..C2) are empty, whilst their corresponding text field (..A1, ..B1, ..C1)  is not empty)

 

I have created a script (Set Indicator Field). And it all works fine when there is only one portal row.

 

MY ISSUE: Occurs when there are multiple portal rows.

For Example:

First Portal Row      - One or more date fields are empty, whilst their corresponding text field is not empty.

Second Portal Row - One or more date fields are empty, whilst their corresponding text field is not empty.

The ‘Set Indicator Field’ is correctly set as “X”

 

What happens: I input a date into one of the empty date fields in the second portal row, and ‘ABC_Indicator’ is cleared.

What should happen. ‘ABC_Indicator’ should continue to be set as “X” whilst any  (X1=1 & X2= 0) condition exits in any portal row.

 

Im hoping someone can help. (Im still consider myself as a learner, so a descriptive reply or example script will save effort in my asking “What do you mean?”)

____________________________________________

 

My Script: Set Indicator Field

 

If          If (

            Portal::Field_A1 > "";

            Portal::Field_A2 < "1"

             )

 

            or

 

            If (

            Portal::Field_B1 > "";

            Portal::Field_B2 < "1"

            )

 

            or

 

            If (

            Portal::Field_C1 > "";

            Portal::Field_C2 < "1"

            )

 

      Set Field [ MainScreen::ABC_Indicator ; “X”

 

Else

      Clear [select ; MainScreen::ABC_Indicator ]

 

End If

____________________________________________

 

My script is executed via each date field trigger (OnObjectModify)

Outcomes