Announcement

Collapse
No announcement yet.

Entity Field with key and value for user to enter

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

  • Entity Field with key and value for user to enter

    Hello,

    is it possible to have a field on an entity where users enter a key and an associated value which can later be used in a pdf template to create a table? Both key and value are different each time.

    Thanks in advance.

  • #2
    I figured out a solution and want to share it in case someone else is looking for something similar.

    I created a new entity and called it something like "keyCurrencyMap" and added a currency field. Changed the Layout of that entity to show the name and the currency value in the list view. Then I added a n:n relation between the entity I need the list on and the new "keyCurrencyMap". After that I changed the layout of the parent entity to show the keyCurrencyMaps and got a list where I can have the name of keyCurrencyMap as the key and the currency value as the value.
    To create a table in a pdf template which reflects the list I used the each helper like so:

    {{#each keyCurrencyMaps}}
    {{#trTag}}
    {{#tdTag width="70%"}}{{name}}{{/tdTag}}
    {{#tdTag width="30%"}}{{curValue}}€{{/tdTag}}
    {{/trTag}}
    {{/each}}

    Now when I print the parent Entity as pdf I get a table which contains all "keys" (name of keyCurrencyMap) in the first row and the corresponding value (curValue field of keyCurrencyMap) in the second row. I hope this helps someone whith the same issue.​

    Comment


    • espcrm
      espcrm commented
      Editing a comment
      Certainly does, requesting a small screenshot of result would be good. Easier to picture (picture worth thousands word as they say)
Working...
X