Skip to main content
Question

vldtstr:strReplaceAll('*12345*', '*', '') not replacing the *

  • June 19, 2024
  • 2 replies
  • 50 views

Forum|alt.badge.img+1

I am new to IFS… I can not get vldtstr:strReplaceAll('*12345*', '*', '') to produce ‘12345’    what am I doing wrong here.  Do I need an escape key for the ‘*’?   vldtstr:strReplaceAll('*12345*', '3', '') produces ‘*1245*’ as expected.   I am trying to strip off the ‘*’ for barcoding purposes in the report designer.

2 replies

VivekBhandiwad
Hero (Partner)
Forum|alt.badge.img+8
  • Hero (Partner)
  • 77 replies
  • June 20, 2024

Hi Steve

Do try other options, considering StrReplaceAll() is not working for ‘*’.  ( not sure why though , the function is defined well )

Trim is one such option. The solution is copied from Functions (ifs.com) 

StrTrim(string,char)

Returns string with all specified characters (both trailing and leading)
removed from the string.

string : A string value you specify. This function removes

the character specified by char from this string.
char : The character to be removed from the string

StrTrim('####short addresses####','#')
In this example, the StrTrim function would return the string
'short addresses'. All leading and trailing '#' characters are trimmed.


Forum|alt.badge.img+1
  • Author
  • Do Gooder (Customer)
  • 1 reply
  • June 20, 2024

I gave up on the StrReplaceAll() function,  it just doesn’t work with the ‘*’.  I was able to use the StrLTrim and StrRTrim() functions to work around it though.   These functions do recognize the ‘*’.

vldtstr:strRTrim(vldtstr:strRTrim(vldtstr:strLTrim(concat(tns:SHOP_ORDER_REP/tns:ORDER_NO,'-',tns:SHOP_ORDER_REP/tns:RELEASE_NO), '*'),'*'),'-')   *12345-* = 12345

 

Thank you for the reply