Show values from 3 fields in a further field summarized

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RSGRG
    Member
    • Feb 2019
    • 72

    Show values from 3 fields in a further field summarized

    I would like to have values from 3 fields displayed together in an additional field. Is this possible? The first field is a selection list (21, 22, 23, etc.) the second field is also a selection list (01, 02, 03, etc.) and the third field is an integer field with a three-digit number entry, e.g. 817. In the fourth field, selected or specified values should then be displayed together. For example like this: 2101817 So the 3 values should be shown together. Not added up.
  • Kpuc
    Member
    • Nov 2020
    • 40

    #2
    You need a formula like this:

    field4 = string\concatenate(field1, field2, field3)

    more info here -> https://docs.espocrm.com/administrat...ingconcatenate

    Comment

    • yuri
      Member
      • Mar 2014
      • 8444

      #3
      Besides formula, it's possible to create a calculated fields manually using complex expressions to define an SQL expression that will be used when the field is selected.

      Note that the field should be notStorable and readOnly.

      In metadata > your entityType > entityDefs

      Code:
      {
          "fields": {
              "yourField": {
                  "type": "varchar",
                  "readOnly": true,
                  "notStorable": true,
                  "select": {
                      "select": "CONCAT:( ... )" // here define your expression to concat fields
                  }
          }
      }
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment


      • telecastg
        telecastg commented
        Editing a comment
        Is it possible to use complex expressions to retrieve attributes from other entities, or just from the entity being defined ?

        Eg. build SQL expressions like: SELECT a.atttribute3 FROM "a" LEFT JOIN "b" ON a.attribute1 = b.attribute2 etc...
        Last edited by telecastg; 06-08-2021, 09:21 PM.
    • RSGRG
      Member
      • Feb 2019
      • 72

      #4
      Great thank you. Worked wonderfully.

      Originally posted by Kpuc
      You need a formula like this:

      field4 = string\concatenate(field1, field2, field3)

      more info here -> https://docs.espocrm.com/administrat...ingconcatenate

      Comment

      Working...