Hey Everyone,
I´m having some trouble with a report in my company and cannot get around to it.
There is one specific model attribute that is supposed to be filled with as many values as needed. It is a glossary of technical terms. I need to output the value of this attribute to a table in the report, and this table should be made of as many rows as the number of technical terms and definitions that were filled in the attribute´s value.
To make sure I made it clear, here is an example:
The Attribute value reads: "term1: definition1; term2: definition2; term3: definition 3;(...);termX: definitionX"
The result in the report should be a table with two columns that looks something like:
Term1: Definition1
Term2: Definition2
Term3: Definition3
(...)
TermX: Definition X.
I hope I could make myself clear. Any help towards achieving that would be greatly appreciated.
Thanks in advance to everyone in the community.
Kay Fischbach on
Don't know if you know how to get the Attribut value, I'll just write it here to make sure it's there
Hmm, might be a bit primitive, but I would use the Javascript String.split() function.
See https://www.w3schools.com/jsref/jsref_split.asp to read how exactly it is used.
Basically you will split your string first at each semicolon + space occurrence, and the result of that, before adding it to the return-array, will be split once more at every colon + space occurrence.
With this method (or something similar) you can build yourself a two dimensional array, where elements in the top array represent a term+definition combination, and then the lower level array has two values: the individual term and the individual definition.
You can then create a table, and handle the row creation with a loop through the created 2D array.
Of course you can supplement the whole thing with checks whether or not stuff is null, or arrays aren't accessed out of bounds, but I wrote my example plain and simple for the ideal case.