Concatenate multiple items


I'm slightly confused on the best approach to concatenate multiple items into a single text line item (where neither is a code or part of a list)

For example lets say I have a module with the following line items

T1, T2, T3, T4, T5, T6 and T7 and Concat line item is C1

Currently C1 shows: T1 & "_" & T2 & "_" & T3 & "_" & T4 & "_" & T5 & "_" & T6 & "_" & T7

Based on my understanding that I should break this up into smaller chunks among multiple line items. For example

New 1: T1 & "_"

New 2: T2 & "_"

New 3: T3 & "_"

New 4: T4 & "_"

New5: T5 & "_"

New6: T6 & "_"

For the above I did read, it's preferred to use:

New 1: is isnotblank(T1) then T1 else blank

(Since T7 doesn't have a "_" afterwards, no need to recreate the same line)

Next would be to start creating small concats with the first group of new lines

New10: New1 & New2

New11: New3 & New4

New12: New5 & New6

New20: New10 & New11

New21: New12&T7

Updated C1: New20 & New21.

Example 2:

Multiple Boolean Line Items (B1 - B20) and Combined Text (C1)

C1: If B1 then "T" else "F" & "|" & if B2 then "T" else "F" & "|", etc

Would this follow the same as my first example

Would this be the correct approach? What I'm confused about is when I look at example of the best ways to concate, they all seem to reference multiple "code" line items and a system module should be created and that new module referenced.



  • @cmast

    Correct, you want to do the least amount of concatenations as you can as that is a massive performance hog.

    In your first example, there are 12 concatenations:
    T1 & "_" & T2 & "_" & T3 & "_" & T4 & "_" & T5 & "_" & T6 & "_" & T7

    You would want to limit that to:

    T1 & T2 Code to Use & T3 & T4 Code to Use & T5 & T6 Code to Use & T7

    where the delimiter for T2, T4, and T6 are in the SYS modules with the formula being: "_" & T2 & "_"

    By doing this, there are only 6 concatenations.

  • cmast
    edited June 2023

    Can you clarify what "Code to Use" would represent?

    By looking at the formula and 3 delimits for T2, T4 and T6, I would assume that there would be 3 delimit lines that would have the formula: "_" & T2 & "_" (with T2 replaced with T4 for the 2nd line, etc)

    System module - Same dimension/Applies to as original module

    References T1-T7 from original module and has additional Delim Lines

    Original Module would reference System Module - Final Concat Result

    What is throwing me off is why this would be in a system module vs in the original module, especially if it wasn't going to be referenced by another module? I thought I read somewhere that it was better to have two modules (same applies to) each with 10 line items, compared to 1 with 20 line items, but I'm not sure if this would be the reason or "create once, reference multiple times".

  • @cmast

    "Code to Use" is a line item I created in a SYS module that has the delimiter on the prefix and suffix of the code so I doing less concatenations in the bigger transactional module. But you are right, I didn't explain it very well. Take a look at this article for more clarification.