Expression to split these items into rows?

I need a good expression to split this paragraph up (if possible).

Instead I would like a row per - item - starting with (1) or (2) etc… Like this:
2X_3_3f84df9b7980bb7bb909643e39fc5f867a4e41cd.png

Solved Solved
0 42 1,488
1 ACCEPTED SOLUTION

I think you need to do this:

*<<INDEX(   SPLIT(   [ITEM_LIST] , "*" ) , 2 )>>*
<<INDEX(    SPLIT(   INDEX(   SPLIT(   [ITEM_LIST] , "*" ) , 3 ) , "," ) , 1)>>
<<INDEX(    SPLIT(   [ITEM_LIST] , "," ) , 2 )>>
<<INDEX(    SPLIT(   [ITEM_LIST] , "," ) , 3 )>>
<<INDEX(    SPLIT(   [ITEM_LIST] , "," ) , 4 )>>
<<INDEX(    SPLIT(   [ITEM_LIST] , "," ) , 5 )>>

View solution in original post

42 REPLIES 42

Steve
Platinum 4
Platinum 4

Start with this, in another thread with you:

I tried that. It didn’t give me row per row:

That is using the expression you had given me.
NOTE - i made sure it was two lines…

The column receiving the result must of type LongText.

oh ok. It was “text” ill make the change and see what happens. Thanks again Steve, as always!

I changed “Item_List” to type LongText - it still gives exact same results.

Screenshots, please.

Expression in my Google Doc:
2X_9_96babc31e2f7cd86f457eaa3aea7969f136e9076.png

Result:

Table:

Hmm… I honestly don’t know if that should work in a template. I’ve only ever used it within the app itself. You could try creating a virtual column with the SPLIT() expression as its app formula, the use that in your template rather than the SPLIT() expression.

ok. Thanks Steve. I used SUBSTITUTE - not SPLIT. Do you mean use Split() instead?

Whoops! Yes, I should have said SUBSTITUTE(). Sorry for the confusion.

I gotcha. So i tried it - same result. Could i just set up a bunch of SPLIT() expressions - and hopefully have enough to fill enough rows?

<<Index(SPLIT([Item_List],“,”),1)>>

etc…

You could certainly try. It’ll be ugly.

ok. Thanks

It looks ok. But i have a question. How can i make the “Rental Return” be at the top ONLY. Then each row follows under neath?

I tried and this is what i got - “*Rental Return” - shows up twice?

I don’t know what your current template or expressions are.

Template:

So that top expression - is a little different because the data at the beginning has a “*”.

For example:
" * “Rental Return” * " - Well you cant see - but that has **** on both sides of it…

*Rental Return occurs twice because both of your first two expressions produce it:

<<Index(SPLIT([ITEM_LIST], "* "), 1)>>
<<Index(SPLIT([ITEM_LIST], ","), 1)>>

How do I make Rental Return be the first line only. And then each line after…?

Also I thought the "* " was different than the ", "

Shouldnt it look at the " * " differently than ", "?

Meaning as two separate lines

Should it be:
<<Index(SPLIT([ITEM_LIST], "* "), 1)>>
<<Index(SPLIT([ITEM_LIST], “,”), 2)>>

There’s no easy way to do it. Your input isn’t well structured for the tools AppSheet provides. I’m still looking at it, though.

It still looks pretty good:
2X_0_0790ab2fd0016379aea1d9b9f21e85391747cab6.png

But i just wish i could move that first row - After the “None” down…

Try replacing those first two with these:

<<INDEX([ITEM_LIST], "* ", 1)>>*
<<INDEX(SPLIT(INDEX(SPLIT([ITEM_LIST], ","), 1), "* ", 2)>>

I think i am missing a “)” in your second line?

Also in the first line - do i put the “*” at the end?

Yep, missing parenthesis. Corrected:

<<INDEX(SPLIT(INDEX(SPLIT([ITEM_LIST], ","), 1), "* "), 2)>>

The extra * is to replace the one SPLIT() removes, so you get *Rental Return* instead of *Rental Return.

Ok. Let me try this. BTW - I wouldn’t have come close to what you have. Thanks so much…

It doesnt fire the workflow rule now. I am guessing the expression has an issue?

Eek! Another typo, this time in the first expression. Try this:

<<INDEX(SPLIT([ITEM_LIST], "* "), 1)>>*

ok. It runs now. But i don’t see the ", " forcing a new line, see image:

Shouldn’t those items (i circled) be a new row?

Oh wait - i just realized - it has the same data twice. So your first two rows are all i should be using? If so, how come it doesnt put each on a new row?

It’s a problem with my second-line expression. Hold…

I don’t see a problem with it, but let’s try this instead:

<<INDEX(SPLIT(INDEX(SPLIT([ITEM_LIST], "* "), 2), ","), 1)>>

It looks the same to me:

I will say this. You got the first part on the first line:
Rental Return

Whoohoo!

Hmmm… It works for me from Expression Assistant. Please paste the text of that entire rental return message into a reply so I can test with it.

the template? the result is an email.

No, the text the template is processing.

Rental Return (1) [000000183] 2006 16’ LOWBOY TRAILER - VIN # 5FVBU16296B008780 - PLATE #625327H ,(1) [000000272] 2012 16’ LOWBOY TRAILER - VIN # 17XFH1625C1026074 - PLATE # 72114N ,(1) [000050077] 4,000 PSI HOT WATER PRESSURE WASHER SKID ENGINE: D1005-1GN0859,(1) [0706-35] 4,000 PSI HOT WATER PRESSURE WASHER SKID ENGINE: D905-6A2663,(6) [R-2 HOSE 50FT] 50FT R-2 PRESSURE HOSE,(2) [TRIGGER GUN] TRIGGER GUN

That? That is the ACTUAL column value for [Item_List]

The first part “Rental Return” has * on both sides - FYI

Thank!

The expressions appear to work correctly.

In your template, please remove all of the INDEX() expressions then add them back one by one, testing after each, until the output isn’t what you want. Then post a screenshot of the expressions in use and the output.

Ok - i took out the first 3 “index” and it wouldnt fire until this one was put back. However - still not putting each row by row:

2X_b_be7f797b1754421e710c36fd1b766a346e1c2670.png

Thanks Steve for all your help on this!

It does, but every time you use SPLIT(), you tell it to look at the entire original input list. The parts you’ve already seen are still there in the original.

Top Labels in this Space