Jump to content
  • 0

Table trigger on insert data to replace line breaks with spaces


Roosta

Question

Hello all,

Does anyone have any idea how to update a field when data is inserted (this is from an external API) to remove line breaks in a text field?

I already have various ones set up like the example below to replace some characters with a space but don't know what I would use instead of the "/" in the shown example to reomve a line break. I have tread CHAR(10), \n, \r etc but wasn't expecting those to work and they didn't. If it was just a basic SQL I would use something similar to REPLACE(REPLACE([@field:Prop_Address], CHAR(10), ' '), CHAR(13), ' ') but have no idea how to achive this in the Caspio GUI.

 

 

Screen1.jpg.443ee8c59466e46eb4913860f38ee0d2.jpg

 

Thanks for looking!

 

Cheers, Roosta

Screen1.jpg

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello,

One possible solution could be to create a formula field with the formula "REPLACE(REPLACE([@field:FIELDNAME], CHAR(10), ''), CHAR(13), '')"

Then, if you need it, in the Triggered Action you can assign that field to the "inserted" formula field.

image.png.1125dfaa8603c0edb7998ced5052e1ec.png

Link to comment
Share on other sites

  • 0

@Barry

Thanks for looking, I eventually used a formula field in the table to get around this:

CAST( (REPLACE(REPLACE([@field:Prop_Num], CHAR(10), ' '), CHAR(13), ' ') + ' ' + REPLACE(REPLACE([@field:Prop_Address], CHAR(10), ' '), CHAR(13), ' ')) AS nvarchar(40) )

Not the most elegant solution but did what I needed it to do but will certainly look at your suggestion for future issues.

 

Thanks, Roosta!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...