Understanding the replaceword( function

Trying to clean up entries in a field, and I designed this action formula, but it doesn’t work. Not sure what I am doing wrong.

formulafill replaceword(«2021 > Enrollment extra names»,“TShirt”,"")

formulafill replaceword(«2021 > Enrollment extra names»,“IslandSun”,“Island”)

I’ve tried creating a procedure with this and also just clicking on the field and using Morph formula fill, but neither works.

One of the records in the database field reads “IslandSun TShirt, Goin’ Swimmin’ TShirt , $15 Snack Deposit” and I’d like it to read only “Island, Goin’”

Instead of replaceword( use replacewordexact(. The nonstandard capitalization does not work with the replaceword( function.

Partial success! It worked to remove “TShirt” entirely, “Donation to Scholarship Fund” entirely, replacing “IslandSun” with “Island”, “Coral Palms - DriFit” with “Coral” and “Surfboards -DriFit” with “Surfboards”, but it did not replace “Goin’ Swimmin’’” with just “Goin’” or with removing “$15 Snack Deposit” entirely. I think the apostrophes in Goin’ and Swimmin’ are giving it problems, but not sure what’s up with the snack deposit phrase

In my test this worked properly and replaced “Goin’ Swimmin’’ with just plain “Goin”.

The $ character is the problem here and I can eliminate all the rest as long as I ignore the dollar sign. You could use a straight replace( function in this case.

formulafill replace(«2021 > Enrollment extra names»,“$15 Snack Deposit”,"")

As long as these words and phrases are not present within other words you could use the replace( function for all of it.

It took away the “Snack Deposit” but not the $15. I wouldn’t spend so much time on this, but I will be creating a weekly database that uses these same sets of Enrollment Extras pulled from registration forms each week for 35 separate databases, and the label we use to pull the TShirts has room only for the simple title of the shirt and not all the other extras. I know I can simply remove those $15 and $10 and $20 manually, but there are 400 to 500 records each week. I’ll keep trying other options. Thanks for your help!!

You can try this solution with a formulafill in the pertinent field. It first checks to see if the field begins with the “$” character and if not it leaves the current value. But if it does start with a dollar sign it uses arrayrange( with a space as the separator to remove the first element containing the dollar amount.

formulafill ?(«» beginswith "$",arrayrange(«», 2, -1, " "),«»)

Looking back at that you originally wanted to remove the entry entirely if it starts with a dollar amount you would simplify the formula to:

formulafill ?(«» beginswith "$","",«»)

Now any item in the field that starts with the $ character is blanked completely. I think that is what you requested but there may be more involved that I’m not aware of at this point.

Thanks, Gary! Somehow I missed the notification that my question had been answered, and I’m just now finding this suggestion.
When I went to my field which looked like this and morphed with the formula you shared, it took away everything in the field, not just the “$15 Snack Deposit” or other snack deposits, if it contained even one item with a $ in it, so I lost the TShirt styles. But thanks for the suggestion; I can use that in a different set of data.


Actually, I discovered the Search function Find&Replace would work if I used the Option Exact Characters

If you pick that option then Panorama is using the change statement.

Remember, you can always turn on the procedure recorder and then perform any data action to find out what code is needed to automate that action.