Expression

 

SPLIT(
(" , " & [PDF REPORT] & " , "),
(" , " & [CONSIGNMENTS ID] & " , ")
)

Example: 
[PDF Report ] has list of values A,B,C,D,E,F,G
[CONSIGNMENTS ID] has value E

What will be the answer/result ?

 

Please Explain this expression

Solved Solved
0 4 133
1 ACCEPTED SOLUTION

SPLIT(
(" , " & [PDF REPORT] & " , "),
(" , " & [CONSIGNMENTS ID] & " , ")
)

This expression is using the value of [Consignments ID] to split the value of [PDF Report] - more specifically its using the value " , E , ". 

Assuming [PDF Report] is define as a List type and not Text then the value being split is " , A , B , C , D , E , F , G ,

When the SPLIT is applied the result you get depends on how the resultant column is defined.  

  • If the resultant column is defined as a List of Text, (e.g. List or EnumList)  and the Element Type is Text (the normal configuration) you will get the result of "A , B , C , D , F , G".   See image.  What happens is the original list is split by the value of "E" and creates a list of 2 lists.  BUT because the result column is defined as a List of Text, AppSheet will apply some automatic "re-structuring" to maintain that definition.  This includes "trimming" of of any insignificant characters and "flattening" the list back to a List of Text.
  • If the resultant column is Text type, you will get "A,B,C,D, F,G" - there is a purposely placed space in front of the F.  This is the text representation of a List of Lists.

Now your next question might be... What if I apply an INDEX() function?   The result depends on WHEN you apply that INDEX() function.  If you INDEX( , 1) in the same expression as the SPLIT your result is "A , B , C , D".  See "Test 5" in image.  However, if you INDEX() the resultant List column itself, you will only get "A" returned because the list had already been flattened out to just a List of Text.

Screenshot 2023-09-19 at 11.02.53 AM.png

Things can get really strange when you try managing List of Lists.

I hope this helps!

View solution in original post

4 REPLIES 4

SPLIT(
(" , " & [PDF REPORT] & " , "),
(" , " & [CONSIGNMENTS ID] & " , ")
)

This expression is using the value of [Consignments ID] to split the value of [PDF Report] - more specifically its using the value " , E , ". 

Assuming [PDF Report] is define as a List type and not Text then the value being split is " , A , B , C , D , E , F , G ,

When the SPLIT is applied the result you get depends on how the resultant column is defined.  

  • If the resultant column is defined as a List of Text, (e.g. List or EnumList)  and the Element Type is Text (the normal configuration) you will get the result of "A , B , C , D , F , G".   See image.  What happens is the original list is split by the value of "E" and creates a list of 2 lists.  BUT because the result column is defined as a List of Text, AppSheet will apply some automatic "re-structuring" to maintain that definition.  This includes "trimming" of of any insignificant characters and "flattening" the list back to a List of Text.
  • If the resultant column is Text type, you will get "A,B,C,D, F,G" - there is a purposely placed space in front of the F.  This is the text representation of a List of Lists.

Now your next question might be... What if I apply an INDEX() function?   The result depends on WHEN you apply that INDEX() function.  If you INDEX( , 1) in the same expression as the SPLIT your result is "A , B , C , D".  See "Test 5" in image.  However, if you INDEX() the resultant List column itself, you will only get "A" returned because the list had already been flattened out to just a List of Text.

Screenshot 2023-09-19 at 11.02.53 AM.png

Things can get really strange when you try managing List of Lists.

I hope this helps!

1. I really admire your efforts taken for explaining the expression by composing a lengthy para.

2. I am completely clear with your explanation. Even Google Bard and Chat Gpt has given wrong answers. 

Thank you so much for your contribution. 

With Regards,

Jaichith J

 

  • If the resultant column is Text type, you will get "A,B,C,D, F,G" - there is a purposely placed space in front of the F.  This is the text representation of a List of Lists.

 

Bro, I could not understand above  point . please explain little deeper.

--------------------------------------------------------------------------------------------------

(" , " & [PDF REPORT] & " , "),

 above, part of the expression won't making the out put as ",A,B,C,D, F,G" instead of "A,B,C,D, F,G" ? 

 

Yes you are right!!!  I tested it but was typing it in from memory.  Actually the resulting value is as shown below.

Screenshot 2023-09-19 at 1.18.01 PM.png

Top Labels in this Space