Announcement

Collapse
No announcement yet.

ifThenElse formula for three fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ifThenElse formula for three fields

    Espo Version: 6.0.8
    Advanced Pack 2.6.5

    Hello!

    I am using the ifThenElse formula when I need a string/concatenate field like this:

    Formula Code:

    ifThenElse(fieldTwo,
    combifield = string\concatenate('Text One: ',fieldOne,'; Text Two: ',fieldTwo),
    combifield = string\concatenate('Text One: ',fieldOne));

    This works very nice. Text Two and fieldTwo are only displayed, when fieldTwo is not empty.

    But I would need a combifield with fieldOne, fieldTwo and fieldThree, displaying always Text and Field, if Field is not empty.

    How can I extend that Formula Code working alternating for three fields?

    ​​​​​​​Thank you!

  • #2
    Hello!

    Code:
    $combifield = ''; // this is the initiated value
    
    ifThen(
       fieldOne,
       $combifield = string\concatenate('Text One: ', fieldOne);
    );
    
    ifThen(
       fieldTwo,
       $combifield = string\concatenate($combifield, 'Text One: ', fieldTwo);
    );
    
    
    ifThen(
       fieldThree,
       $combifield = string\concatenate($combifield, 'Text One: ', fieldThree);
    );
    
    // now set the value to the field.
    combifield = $combifield;

    Click image for larger version

Name:	Screen Shot 2020-12-19 at 4.59.20 PM.png
Views:	423
Size:	125.9 KB
ID:	65703
    CEO of Eblasoft
    EspoCRM Expert since 2014
    Full Stack Web Developer since 2008
    Creator of Numerous Successful Extensions & Projects​

    Comment


    • #3
      Hi Eymen!

      Does exactly what I need! Thanks so much!

      Best Regards

      Comment

      Working...
      X