Calling GEL and Java gurus, I'm neither and this is making me crazy.
I'm creating a GEL script that parses a tab-delimited text file regarding product shipments, then builds a XOG file and imports it into a custom object. So far, so good ... except for one thing I can't do ...
My source data contains the shipment date's year (4 digits) in column 25 and the shipment date's month (1 or 2 digits, depending upon the month) in column 27. My intention is to concatenate the two values into a 6-character YYYYMM value (examples: January 2019 = 201901, November 2018 = 201811, etc.).
While debugging, I'm simply logging the values so I can see the results. My code is:
I've tried all sorts of ways to pad and concatenate those strings, but I can't figure out how to: 1) zero-pad the month value so that 1 becomes 01, 2 becomes 02, etc., but 10, 11 and 12 remain 10, 11 and 12 (with no padding), and; concatenate the two values into a single string.
Java zero-padding articles, haven't been helpful -- I can't figure out how to incorporate what I read in those articles into the GEL script and make it work. So my workaround is open the text file in Excel, add an additional column that uses the TEXT() formula to pad and concatenate the two strings, and re-save the TXT file with the extra column -- then just doing a straight read of that column to get my YYYYMM value, which is already transformed. But I'd REALLY prefer to not have to do that extra maintenance on the source file every time.
If anyone could provide a code sample of how to do this, you'd be my hero.