Parse text from large string
@Paul Newcome - I've read a lot of your discussions throughout the years and you are the MAN! I have a question down below and hoping you can walk me through it. I'm simply not that good at this particular formula design.
I have a SF Connector setup and it pulls the below string. The total character length of the string is seldom the same for each row that comes in. I'm trying to parse certain information from this string. I feel like if I can get the formula down, I'd be off to the races.
To start, I just need (for now) the SUBTOTAL (which in the case below should be 630. Basically I need to find the subtotal, and then parse out the value (630).
{"PurchaseOrder" : {"@timeStamp":"2021-12-29 12:44:28","Request":{"Payment":{"@method":"AB"},"OrderType":"NC","Detail":{"Totals":{"Total":"576.19","SubTotal":"630","Delivery":"0"},"Item":[{"VendorPack":"1","VendorID":"01234567","Units":"1","UnitPrice":"630.0","UnitOfMeasure":"EA","Taxable":"Y","Sku":"987654321","QuoteID":"Channel","Qty":"1","MerchClass":"635","ManufacturerPartNum":"01-00860-101","ManufacturerID":"000123456","ListPrice":"699.99","LineNumber":"1","Description":"XXXXX","CustomerLineNumber":"1","CostCenter":"","Cost":"576.19","CatalogPage":""}]},"Accounting":{"Release":"","PONumber":{"*body":"PO12345"},"Desktop":"","CostCenter":""}},"Header":{"ShipTo":{"Addr":{"@seq":"00003","Contact":{"PhoneNumber":{"Number":"(000) 000-0000"},"Name":"JOHN SMITH","Email":{"*body":"johnsmith@gmail.com"}}}},"ShipComplete":"N","Sender":"SalesForce","Returnable":"N","DropShip":"Y","CustomerID":"012345678","Comments":"No Comments","BillOnly":"N"},"@documentid":"a8t2S000001ZjHEQA0"}}
Best Answer
-
Sorry my mistake the 160 shouldn't have been there it should have been start@row
Nested =MID(Text@row, FIND("SubTotal", Text@row, 1) + 11, FIND(CHAR(34), Text@row, FIND("SubTotal", Text@row, 1) + 11) - (FIND("SubTotal", Text@row, 1) + 11))
Answers
-
I did helper columns but you could nest it
Start =FIND("SubTotal", Text@row, 1) + 11
Length =(FIND(CHAR(34), Text@row, 160)) - Start@row
Subtotal =MID(Text@row, Start@row, Length@row)
-
It wasn't working until I replaced the "160" from your LENGTH equation with Start@Row. Then it worked FLAWLESSLY!!!!
What would a nested version of this look like? (I'm sorry I'm a bit of a noob when it comes to the equation side of the platform -- I've got dashboards and portals and workflows and automations covered, but I'm two left feet with complex nesting)
-
Sorry my mistake the 160 shouldn't have been there it should have been start@row
Nested =MID(Text@row, FIND("SubTotal", Text@row, 1) + 11, FIND(CHAR(34), Text@row, FIND("SubTotal", Text@row, 1) + 11) - (FIND("SubTotal", Text@row, 1) + 11))
-
That's pretty much how I would have done it as well.
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
SWEET! Thank you so much Paul I appreciate it!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.8K Get Help
- 376 Global Discussions
- 207 Industry Talk
- 438 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 284 Events
- 33 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!