AnsweredAssumed Answered

Text Parsing by Pipe Character

Question asked by baldewicz on Dec 2, 2016
Latest reply on Dec 2, 2016 by David Moyer

Hi All,

 

I am not the greatest at text parsing and I am a bit stumped on this most likely easy task.  I am trying to have an easy way to remember how the user navigated though a group of records so they maintain the ability to go back.  When a user is on the  Main Menu (MM) the Report::Position is automatically set to 1, once a user navigates to another record a pipe character is added and the selected records PK is appended to the list: 1|2.  I need to allow the user to navigate back though the list.

 

For example I have a field which has a list of pipe delimitated numbers :  1|2|16|8

 

I am able to return the second to last entry: 16

Using:

Let(

~values = Substitute(Report::Position; "|"; ¶);

GetValue(~values;ValueCount(~values)-1)

)

I am able to get the count of the number of pipes:

PatternCount ( Report::Position;"|" )

But I also need to trim the list after grabbing the second to last entry

 

What I am looking for is, and this very likely isn't the best way to do this:

 

If (PatternCount(Report::Position;"|")<2;

 

The list should revert to Main Menu (1) ;

It should grab the second to last number and trim the last Pipe Characters off of the string )

 

 

Example: Starting with 1|2 should grab the number 1 and set the  return 1 as the new list, where as starting with 1|2|16|8 should grab the number 16 and should return 1|2|16 as the new list.

 

I hope this makes since.  Thank you all!

Sandy

 

Message was edited by: Sandra Baldewicz

Outcomes