command to string search?

Use this board to ask questions or have discussions with other JumpStart users.
sherimc
New User
Posts: 7
Joined: Mon Jun 05, 2017 1:03 pm
First Name: sheri
Last Name: mcpherson
Company Name: winsupply
Contact:

command to string search?

Post by sherimc »

Hello,

I am wanting to use the #fileDescription to name procedures in my MVC template; however, I need the ability to "scan" and "replace" unnecessary characters. Is there a way to do this that I am not aware of currently?

For example, our file description looks like this: SO-Shipments-Header Level Tax Info

I want to squeeze out the hyphens and spaces.

Thanks,
Sheri McPherson
User avatar
matt.denninghoff
Profound Logic Staff Member
Posts: 115
Joined: Wed Feb 10, 2016 3:53 pm
First Name: Matthew
Last Name: Denninghoff
Company Name: Profound Logic Software
State / Province: Ohio
Country: United States
Contact:

Re: command to string search?

Post by matt.denninghoff »

Yes, there is a relatively new template directive, #eval, which allows you to use javascript in the pre-processing phase. So if you were to use the JavaScript replace function, then you can remove spaces and dashes with this:

Code: Select all

#eval("#fileDescription".replace(/[- ]/g,""))
Then the resulting file description would be: SOShipmentsHeaderLevelTaxInfo

The form of replace above uses a Regular Expression with the "global" flag, to match and replace all instances of either "-" or " ". #eval came out with Profound UI version 5.7.0.
sherimc
New User
Posts: 7
Joined: Mon Jun 05, 2017 1:03 pm
First Name: sheri
Last Name: mcpherson
Company Name: winsupply
Contact:

Re: command to string search?

Post by sherimc »

Matt,

Thank you very much for letting me know! I have very limited experience with JavaScript am a RPG programmer trying to use Jumpstart. Your help is greatly appreciated.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests