EXEC_STRING Question

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1458
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

EXEC_STRING Question

Post by PointsWell »

I have a bunch of international addresses.

I can let the user key it all into one text field and they can then be responsible for international formats. Downside I lose visibility of things like Country and City from a systems point of view.

I can alternatively specify the various components of an address. Upside City and Country are visible. Downside is that it is hard to generate a letter with the address formatted.

My idea was to parse the address into a text block that the user doesn't see but gets used by queries etc.

My plan was to parse these in a field on the Country reference data and use EXEC_STRING and it works quite well except I don't seem to be able to use conditional statements in there. For example not all addresses might have a Line2, so if you just build up the block text as

Code: Select all

Address.Block=Address.Line1+CR()+Address.Line2+CR()+Address.City+' '+Address.PostCode+CR()+Address.Country
If Address.Line2 is blank then you get a blank line, because you can't put an IF statement to check it's blank.
I could buy a plug in that does address parsing, but the cost of that was prohibitive (~$10k). Does anyone have any suggestions as to how to loop in conditional statements and EXEC_STRING?

The solution would need to be relatively straightforward - ie encapsulatable in a repeatable format which is why EXEC_STRING looked attractive.
PointsWell
Posts: 1458
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: EXEC_STRING Question

Post by PointsWell »

Ha! I was going to use the AddressBlock attribute to then show a custom query and just display the AddressBlock but CR() != <br>

So I get my trimming, and no blank lines, but also get no lines just one line... Damn HTML and CR incompatibilities.

So my plan to 'fix' this I thought a second field AddressBlockHTML and using REPLACE_PATTERN to remove the \r\n and replace it with <br>. And so today disappeared down that hole.

What is the correct format to remove \r\n from the text? Ideally multiples which would fix the blank lines issue
BobK
Posts: 545
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: EXEC_STRING Question

Post by BobK »

PointsWell wrote:What is the correct format to remove \r\n from the text? Ideally multiples which would fix the blank lines issue
On a Windows system using MySQL the following worked:
BO.Attr2=REPLACE_PATTERN(BO.Attr1, '\x0A', '<br>')
Bob
PointsWell
Posts: 1458
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: EXEC_STRING Question

Post by PointsWell »

BobK wrote:
PointsWell wrote:What is the correct format to remove \r\n from the text? Ideally multiples which would fix the blank lines issue
On a Windows system using MySQL the following worked:
BO.Attr2=REPLACE_PATTERN(BO.Attr1, '\x0A', '<br>')
That doesn't work either. I'm using Mac and build 2720.
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: EXEC_STRING Question

Post by aware_support »

Try REPLACE_PATTERN (Obj.Attr, CR(), "<br>")
Aware IM Support Team
PointsWell
Posts: 1458
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: EXEC_STRING Question

Post by PointsWell »

aware_support wrote:Try REPLACE_PATTERN (Obj.Attr, CR(), "<br>")
The issue is that REPLACE_PATTERN and EXEC_STRING will not co-exist in a BO rule.

Have had to separate out everything to a process called by the BO Rule instead.
Screen Shot 2020-06-22 at 13.41.58.png
Screen Shot 2020-06-22 at 13.41.58.png (16.16 KiB) Viewed 5364 times
Post Reply