Return one value for multiple conditions

In the image bellow the 3fields in the square come from a dropdown  ("SI" or "NO") in a user interface.

I can see the user responses in a read-only grid (see the image bellow). 

I want IF 3 condition ("Financial", "Documents", "Certificate") in the red square are "SI" then the column "Estado" return a new value "Finalizado"

 IF just one condition ("Financial", "Documents", "Certificate") in the red square are "NO" then the column "Estado" return a new value "Pendiente"

Next i want to store the value of the column "Estado" in my cloud database

  Discussion posts and replies are publicly visible

  • 0
    Certified Senior Developer

    To store the data into DB, you have to create a link or button for the action to writeDataintoDatastore but to show the value into Estado column. you can use the below code under value configuration of the grid column of Estado.

    if(
    and(
    fv!row.financial="SI",
    fv!row.documents="SI",
    fv!row.certificate="SI",
    ),
    "Finalizado",
    "Pendite"
    
    
    )

  • Hi Deepak

    Thanks so much,

    Im trying but now i want to do this:

    IF 3 condition ("Financial", "Documents", "Certificate") in the red square are "SI" then the Text Filed  "Estado de proceso vendedor" return a new value "Finalizado"

     IF just one condition ("Financial", "Documents", "Certificate") in the red square are "NO" then the Text Filed  "Estado de proceso vendedor" return a new value "Pendiente"

    This part is new

     IF 3 or 1 condition ("Financial", "Documents", "Certificate") in the red square are "EMPTY" then Text Filed  "Estado de proceso vendedor" return a new value "En Proceso"

    In the blue square (image bellow) is the value generate by the conditions above, i want that value store in my CloudDatabase after clicking SUBMIT button.

    This is the expresión of the Text Filed  "Estado de proceso vendedor" 

    a!textField(
    label: "Estado de proceso VENDEDOR",
    labelPosition: "ADJACENT",
    value:
    if(and(
    ri!CWA_OECVendor.oecvendorverffinancial ="SI",
    ri!CWA_OECVendor.oecvendorverfdocs ="SI",
    ri!CWA_OECVendor.oecvendorregistroac ="SI"
    ),
    "Finalizado","Pendiente"
    ),
    saveInto:
    a!save(ri!CWA_OECVendor.oecvendorstatus,
    if(and(
    ri!CWA_OECVendor.oecvendorverffinancial ="SI",
    ri!CWA_OECVendor.oecvendorverfdocs ="SI",
    ri!CWA_OECVendor.oecvendorregistroac ="SI"
    ),
    "Finalizado","Pendiente"
    )
    ),
    refreshAfter: "KEYPRESS",
    characterLimit: 55,
    required: false,
    readOnly: false,
    align: "LEFT"
    )

  • 0
    Certified Senior Developer
    in reply to danna3499

    With the click of a button, you can save the variable value by using the same expression which you are using for visibility. And use that variable while insertion.

  • Thanks it works.

    and for this part please 

    IF 3 condition ("Financial", "Documents", "Certificate") in the red square are "SI" then the Text Filed  "Estado de proceso vendedor" return a new value "Finalizado"

     IF just one condition ("Financial", "Documents", "Certificate") in the red square are "NO" then the Text Filed  "Estado de proceso vendedor" return a new value "Pendiente"

    This part is new

     IF 3 or 1 condition ("Financial", "Documents", "Certificate") in the red square are "EMPTY" then Text Filed  "Estado de proceso vendedor" return a new value "En Proceso"

  • 0
    Certified Lead Developer
    in reply to danna3499

    Just to be sure, please be aware that a TextField's "saveInto" parameter does not make any changes whatsoever until/unless the text field itself is interacted with.  Thus if you're hoping the "saveInto" of your text field is going to insert some novel calculated value elsewhere, it's not going to work.  Generally the best place to put such logic is in a button, to be evaluated and saved upon user click. 

    In your case, if you wish to display the value and then also save it into a data output upon submission of the form, it would be advisable to calculate / store the value in a local variable, show the value in a read-only text field, and also store the value of the local variable into your rule input upon "submit" click.

  • THIS PART PLEASE

    IF 3 condition ("Financial", "Documents", "Certificate") in the red square are "SI" then the Text Filed  "Estado de proceso vendedor" return a new value "Finalizado"

     IF just one condition ("Financial", "Documents", "Certificate") in the red square are "NO" then the Text Filed  "Estado de proceso vendedor" return a new value "Pendiente"

    This part is new

     IF 3 or 1 condition ("Financial", "Documents", "Certificate") in the red square are "EMPTY" then Text Filed  "Estado de proceso vendedor" return a new value "En Proceso"

  • 0
    Certified Lead Developer
    in reply to danna3499
    THIS PART PLEASE
    THANKS IT WORKS

    I'm a bit confused - do you still have a question with creating this logic, or do you have it working now?

  • Is working the saveInto part (thanks so much)

    But the logic part (bellow) i can't make it work

    IF 3 condition ("Financial", "Documents", "Certificate") in the red square are "SI" then the Text Filed  "Estado de proceso vendedor" return a new value "Finalizado"

     IF just one condition ("Financial", "Documents", "Certificate") in the red square are "NO" then the Text Filed  "Estado de proceso vendedor" return a new value "Pendiente"

    This part is new

     IF 3 or 1 condition ("Financial", "Documents", "Certificate") in the red square are "EMPTY" then Text Filed  "Estado de proceso vendedor" return a new value "En Proceso"

  • 0
    Certified Lead Developer
    in reply to danna3499
    But the logic part (bellow) i can't make it work

    Please post the current version of the code where you're trying to evaluate this.  Remember that code is > 10x more readable when you put it in a Code Box.