What BSFN to parse delimited string?

Andrew2009

Well Known Member
I have a period delimited string like

CAR1.CAR2

What bsfn to use to parse this string please?

Any example code would be appreciated.

Thanks

I use JDE 9.X
 
Hi,

You can use the BSFN "Parse Text String (B0500690) ".

VA evt_cColumnDelimitSepartr_EV01 = '.'
Parse Text String
CAR1.CAR2-> BF szInputText
Output Variable <- BF szOutputObjectSegment
<Zero> -> BF mnSegmentNumber
VA evt_cColumnDelimitSepartr_EV01 -> BF cDelimiter

will fetch CAR1
 
I am not sure if you had a look at the bsfn list. Please search with wild card Parse and you will see dozens of them.
 
If you don't like any of the parse delimited string BSFNs currently in the E1 system, I've found that creating my own allowed for me to not have to be concerned with how and if the other BSFNs will work. Some simple code is pasted below. It's a NER.

=======================================================================
NAMED ER: Parse Delimited String
=======================================================================
evt_cComma_EV01
evt_cDoubleQuote_EV01
evt_cInsideQuotes_EV01
evt_cOneChar_EV01
evt_nCurrentSegment_INTEGER
evt_nPositionInString_INTEGER
evt_nStringLength_INTEGER
0001 //
0002 // Initialize Variables
0003 BF szReturnString = ""
0004 VA evt_nStringLength_INTEGER = "0"
0005 VA evt_nPositionInString_INTEGER = "0"
0006 VA evt_nCurrentSegment_INTEGER = "0"
0007 VA evt_cOneChar_EV01 = ""
0008 VA evt_cDoubleQuote_EV01 = """
0009 VA evt_cComma_EV01 = ","
0010 VA evt_cInsideQuotes_EV01 = "N"
0011 //
0012 // Get Length of Input String
0013 VA evt_nStringLength_INTEGER = length([BF szInputString])
0014 //
0015 // Parse Out Desired Segment
0016 While VA evt_nCurrentSegment_INTEGER is less than or equal to BF nSegmentToReturn And VA evt_nPositionInString_INTEGER is less than VA evt_nStringLength_INTEGER
0017 //
0018 // Get the Next Character in the String
0019 VA evt_cOneChar_EV01 = substr([BF szInputString],[VA evt_nPositionInString_INTEGER],1)
0020 //
0021 // Increment Segment Counter or Write to Return String
0022 If VA evt_cOneChar_EV01 is equal to BF cDelimiter And VA evt_cInsideQuotes_EV01 is equal to "N"
0023 VA evt_nCurrentSegment_INTEGER = [VA evt_nCurrentSegment_INTEGER]+1
0024 Else
0025 If VA evt_nCurrentSegment_INTEGER is equal to BF nSegmentToReturn
0026 BF szReturnString = concat([BF szReturnString],[VA evt_cOneChar_EV01])
0027 End If
0028 End If
0029 //
0030 // Account for a beginning or ending " in a string if a comma is the delimiter
0031 If VA evt_cOneChar_EV01 is equal to VA evt_cDoubleQuote_EV01 And BF cDelimiter is equal to VA evt_cComma_EV01
0032 If VA evt_cInsideQuotes_EV01 is equal to "N"
0033 VA evt_cInsideQuotes_EV01 = "Y"
0034 Else
0035 VA evt_cInsideQuotes_EV01 = "N"
0036 End If
0037 End If
0038 //
0039 // Increment String Position
0040 VA evt_nPositionInString_INTEGER = [VA evt_nPositionInString_INTEGER]+1
0041 End While
 
B0500690 allows a 2000 long string. Is that long enough?

In the future look on F9862 for the word Parse and use Object Browser to launch them and see if they'll work for you :)
 
Back
Top