Solved

Stripping Financial Values from Strings in and Arc Map

  • 19 April 2023
  • 2 replies
  • 44 views

Badge

I need to be able to ingest the following string and remove everything but the financial values in an xml map connector

CIGNA;QPA=242.06

any direction is appreciated. This is for an x12 837 file

icon

Best answer by wnielson 19 April 2023, 23:21

View original

2 replies

Userlevel 3
Badge

There’s a pretty good example in the Arc documentation under Scripting > Formatters > String Formatters using regex pattern matching.

I would add a script node similar to the example shown 

<arc:set attr="myString" value="[xpath/YOUR_ELEMENT_FOR_REGEX" />
<arc:set attr="decimalPattern" value="\[0-9\]+\.?\[0-9\]*" />
<arc:set attr="price" value="[myString | regexmatch([decimalPattern])]" />

Then in your map you would set the value to [_map.price]

I would play around with this as I just did a quick and dirty example.

Badge

There’s a pretty good example in the Arc documentation under Scripting > Formatters > String Formatters using regex pattern matching.

I would add a script node similar to the example shown 

<arc:set attr="myString" value="[xpath/YOUR_ELEMENT_FOR_REGEX" />
<arc:set attr="decimalPattern" value="\[0-9\]+\.?\[0-9\]*" />
<arc:set attr="price" value="[myString | regexmatch([decimalPattern])]" />

Then in your map you would set the value to [_map.price]

I would play around with this as I just did a quick and dirty example.

Thanks! I actually was able to find a little bit of a simpler solution by just setting a custom script to
 

<arc:info title="Custom Script" desc="The custom script.">
<input name="FilePath" desc="The sending file path." />
<input name="XPath" desc="The current xpath in the loop." />
<input name="*" desc="The information of the current loop." />
</arc:info>

<arc:set attr="qpaString" value="[xpath(PWK/PWK06)]" />
<arc:set attr="qpaAmount" value="[qpaString | split('=',2)]" />

<arc:set attr="result.text">[qpaAmount]</arc:set>

 

Reply