Skip to main content
Question

Removing character from Text field

  • December 29, 2015
  • 0 replies
  • 568 views

Forum|alt.badge.img+8

I have a text field [Field A]. I would like to create a text formula field [Field B] that removes the character "-" from  [Field A] if [Field A] contains the character "-".

[Field A] = "abc-d"  [Field B] = "abcd"

Thanks

This topic has been closed for replies.

Try this.  I was testing with a data entry field called [Dash text]

Part([Dash text], 1,"-") & Part([Dash text], 2,"-")

Forum|alt.badge.img+8
  • Author
  • Registered
  • December 29, 2015
You do man! Thank you Mark

Shorter:

Left([Field A], "-") & Right([Field A], "-")

But what if there is no dash present?  Then the text would get doubled up.

The poster did not mention that he did not want doubled up text in the odd ball case there was no dash. I consider the case of doubled up text a valuable bonus behavior.


That was trivial.

You should have been impressed with this post:

https://quickbase-community.intuit.com/questions/1282756

I have additional versions of this where I generalize the solution so that *any* summary of child records can be displayed in a field of the parent report. I am working on making the new solution dead simple to reuse.

Yes, that question always comes up on the forum.  A generalized solution would be helpful to the Community.

FWIW, I am not through with my refactoring yet but I posted a more recent version that is more compact and where all the parameters are floated to the top of the script:

https://quickbase-community.intuit.com/questions/1282756

Also there is now a template to summarize the child field to the parent.

Another way to avoid doubling up of text:

If(not Contains([field],"-"), [field],
Left([field],"-")& Right([field],"-"))

This solution is exactly what I need, but I need to run it multiple times, for different special characters. How could I do that?

Can you provide an example of what you mean?

Discussed here

Sorry about that, I responded to a similar post... which Alex linked already... It's regarding filtering out characters:

Part([Project Name],1," !@#$%^&*';:?/><")

My question is this... will this one line of code filter out all special characters listed, no matter how many times they are in the string? or do I need to add possible:

Part([Project Name],2," !@#$%^&*';:?/><") etc?

No, the Part function will locate the nth part of a string as delimited by the delimiter characters.

So you will need

a formula like
List "", 
Part([Project Name],1," !@#$%^&*';:?/><"),
Part([Project Name],2," !@#$%^&*';:?/><"),
Part([Project Name],3," !@#$%^&*';:?/><"),

etc

Part([Project Name],10," !@#$%^&*';:?/><"))

for as many "Parts" as your data might be expected to have.