Extract lines from multi-line text

tony1
New Member

This app shows how to extract lines from multi-line text using the SPLIT and INDEX functions.

https://www.appsheet.com/samples/split-text?appGuidString=49ade14f-f099-4a2d-9b78-3b5e4f43fbfe

6 14 2,294
14 REPLIES 14

Hi @tony,
Is it possible for us to provide a preview of any sample app from our developer portfolio like you have shown in this topic post? If possible, what should be the correct syntax? Thnx.

This is pretty cool…
Can you split based on any delimiter? Example by periods:
N69450.200.1.2.3

@Grant_Stead Yep, you can split on periods. More details here: https://help.appsheet.com/expressions/functions/split

@tony Can I do the reverse?
I have a List:
Apple , Banana , Canteloupe

And I want a Longtext with Newlines:
Apple
Banana
Canteloupe

I know this is possible with an expression like:

CONCATENATE(
INDEX([List],1) , "
" , INDEX([LIST],2) , "
" , INDEX([LIST],3)
)

But if you have a lift with 100 Fruits, this will be a looooong expression

Use SUBSTITUTE():

SUBSTITUTE([list], " , ", "
")

Note the third argument is a double-quoted newline.

Thank you very much @Steve

Hi @tony

Can you split by the Tab key? Like when decoding a QR code? So the QR code contains 4 strings all separated by a tab (Ascii 9)? I’ve asked this in a separate question here

tony1
New Member

@LeventK You can just plop down some HTML that has your app in an iframe. Like this:

<iframe src="https://www.appsheet.com/start/49ade14f-f099-4a2d-9b78-3b5e4f43fbfe?refresh=1&wipe=1" width="100%" height="568" frameborder="0"/>

I’m going to add this HTML to the Share App > Links in the editor, so you can paste your app into the community (similar how you can do youtube embeds).

Yo’r da man @tony! Awesome!! Thought that HTML tagging might work, but not sure. Now it’s totally clear. Appreciate your input. Thnx bro.

tony1
New Member

@Ponch AppSheet expressions don’t allow you to enter character sequences like \t. But you might be able to paste in a literal tab character by following one of these examples (I haven’t tested, though) https://superuser.com/questions/67934/typing-the-tab-character-in-browser-text-boxes

Ok, I am at a loss. I have set up a scanning view for 2D barcodes. All the barcodes contain a single string in this format:

ABCD,EF:GHI123JKL456,MNO:P78Q90RST1,UV:23

“GHI123JKL456” & “P78Q90RST1” represent constants which are always the same length. The number on the end can vary in length of digits.

I would like to be able to extract the “GHI123JKL456”, “P78Q90RST1”, and whatever number is on the end into separate columns so I can then automatically update totals for a daily report. I have everything else working, but I cannot figure out how to extract these since there are no spaces in the string. TIA.

To get GHI123JKL456:

INDEX(SPLIT(INDEX(SPLIT([barcode], ":"), 2), ","), 1)

To get P78Q90RST1:

INDEX(SPLIT(INDEX(SPLIT([barcode], ":"), 3), ","), 1)

To get 23:

INDEX(SPLIT([barcode], ":"), 4)

In each, replace barcode with the name of the column containing the scanned barcode.

See also:

Thanks so much, Steve. Testing now.

Works perfectly. Thank you so much!

Top Labels in this Space