Discussions

Expand all | Collapse all

Removing character from Text field

Brad Elmore12-29-2015 15:23

QuickBaseCoach Dev./Training01-04-2019 20:06

Alex Certification!01-04-2019 20:37

  • 1.  Removing character from Text field

    Posted 12-29-2015 15:04

    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



  • 2.  RE: Removing character from Text field

    Posted 12-29-2015 15:19
    Try this.  I was testing with a data entry field called [Dash text]

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


  • 3.  RE: Removing character from Text field

    Posted 12-29-2015 15:23
    You do man! Thank you Mark


  • 4.  RE: Removing character from Text field

    Posted 12-29-2015 15:46
    Shorter:

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


  • 5.  RE: Removing character from Text field

    Posted 12-29-2015 15:49
    But what if there is no dash present?  Then the text would get doubled up.


  • 6.  RE: Removing character from Text field

    Posted 12-29-2015 15:54
    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.


  • 7.  RE: Removing character from Text field



  • 8.  RE: Removing character from Text field

    Posted 12-29-2015 16:34
    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.


  • 9.  RE: Removing character from Text field

    Posted 12-29-2015 16:39
    Yes, that question always comes up on the forum.  A generalized solution would be helpful to the Community.


  • 10.  RE: Removing character from Text field

    Posted 12-29-2015 16:48
    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.


  • 11.  RE: Removing character from Text field

    Posted 04-08-2016 21:29
    Another way to avoid doubling up of text:

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


  • 12.  RE: Removing character from Text field

    Posted 01-04-2019 19:53
    This solution is exactly what I need, but I need to run it multiple times, for different special characters. How could I do that?


  • 13.  RE: Removing character from Text field

    Posted 01-04-2019 20:06
    Can you provide an example of what you mean?


  • 14.  RE: Removing character from Text field

    Posted 01-04-2019 20:37
    Discussed here


  • 15.  RE: Removing character from Text field

    Posted 01-07-2019 18:48
    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?


  • 16.  RE: Removing character from Text field

    Posted 01-07-2019 19:20
    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.