Announcement

Collapse
No announcement yet.

How to get more than 1 column of a dataset in the relationship panel?

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

  • How to get more than 1 column of a dataset in the relationship panel?

    current 1 column, the name-field from an entity
    Christoph Theuring

  • #2
    Depends on the relationship. For 1:n or n:1 you can create fields and populate them by formula, for n:n you have either to code or use the extension Link Multiple from Eblasoft: https://www.eblasoft.com.tr/espocrm-...le-inline-form

    If you want to print other columns than name, you can use the {{#each}} tag.

    Comment


    • #3
      Hello shalmaxb,
      Thanks for the interesting link and your tip.
      I'm a newbie in espocrm ... and I'm in the learning phase. Can you please tell me WHERE to use the tag and HOW - most suitable with an example.
      My current solution is (in formula) to concat some fileds in the name-field: `name` = string\concatenate(kontaktdatum, " ", kontaktdatum, " ", firma);

      By the way a question about the formlulas: has a script-before-save the same effect as an before-insert/update-trigger in the database?
      I prefer to do operations directly in the database - it's quick (no traffic between server and client), save (if operation failed i.e. of energy-lost, theres is no commit and the database is still clean and it's transparent (every database-expert can understand it, independent of the application-software) - so I try to use trigger and database-functions.

      Thanks
      Christoph

      Comment


      • #4
        sorry about my 2nd question: I forgot the description in the manual (I didn't work every day to lern with espocrm).
        Christoph

        Comment


        • #5
          Follow the documentation for formatting the formula concatenate. Your formula: `name` = string\concatenate(kontaktdatum, " ", kontaktdatum, " ", firma); should look like this:

          Code:
          name = string\concatenate('kontaktdatum', ' ' , 'kontaktdatum', ' ' ,'firma');
          Each field name must be in quotes (I always use single quotes, not apostrophe!). A space means the quotes and a space. A space after the comma is ignored. If You need a line break it is '\n'.

          The #each tag, I mentioned in the former thread is used in PDF Templates and E-mail Templates.

          Comment


          • #6
            Thanks shalmaxb - after RTFM I also found your solution - it's a beginners mistake.
            Ok, now the code is correct - but, WHEN does it run? After every changing on data-set (of the containing fields) or a new dataset? The same as a database-trigger before insert or update?
            I found a description how to run formular manually ... but it does'n t happen ...
            In the description of data-types I found, that the contend of the field "name" in type "person" is "Nachname Vorname" - you can change ist in a comboBox in Administration|Einstellungen|Format of person - so it seems to be hard-coded (because I can't add another format). Do you have a idea in which file is this code? I want to change it to "Anrede Titel Nachname Vorname" (in my database there are more than 100.000 persons ... and there are many dublicate "Nachname Vorname" and also some Vorname do not allow any conclusion on the gender i.e. Maria). So - I changed then content of "name" in table person to my prefered content - by database-sql. But the list-view always shows the "Nachname Vorname" ??? Normally the list-view shows the content of the field "name" ...

            Comment


            • telecastg
              telecastg commented
              Editing a comment
              Formula is just a user friendly gui for writing "before save" hooks without having to write php code.

              If you have a formula and a beforeSave hook, the formula will be executed immediately before the beforeSave hook executes, all of this before the data is persisted in the database.

              Here is a link to information about espocrm hooks: https://docs.espocrm.com/development/hooks/
              Last edited by telecastg; 07-29-2023, 12:07 AM.

          • #7
            Right in the case of a person entity, like contact, the name is already Vorname Name, but you have also the fields separated in that entity. To have that in your list view, you have to go to layout manager, list view (other views the same, if you need it there) and drag the respective fields to the list view panel. You can even drag the name field out to not have the name and second name duplicated in the list. Perhaps you must tick the checkbox "is link" for the second name for example, to keep the ability to open the detail view by clicking on the name.
            The name field is a field that is created in any entity per default and it is configured mandatory (but you may disable the mandatory, depends on your entity).

            I would not recommend to change anything in the code or in the database itself. That would not be update safe and on the long run will be very difficult to maintain. It is not even necessary, because you can configure nearly anything by very simple solutions, which are provided by espoCRM.
            For more complex configurations you may consider coding, if you are skilled enough or rely on third party extensions.

            Comment

            Working...
            X