Automate

 View Only
  • 1.  Composer or Web Service Trim

    Posted 04-10-2020 15:13
    Hello All!

    Has anyone been able to do the equivalent to Excel's TRIM (removing spaces before, after and double spaces) in a Composer solution? I hope I am just overlooking the obvious.

    I tried the following:
    - Composer Field Formula - add Trim in a formula for a field [example = trim($form.getValue('/my:myFields/my:field_1'))] - results - no change to the field on the form
    - Script Formula - Since the script is an XML, there is no option to include a transform rule

    I saw the option of normalizeSpace in the Composer function options, but I do not want to remove single spaces in the middle of text (like an home address).

    Any help would be appreciated!

    Thanks!

    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------


  • 2.  RE: Composer or Web Service Trim

    Posted 04-13-2020 07:30
    I think there is a padding rule in the rule wizard that you can use for controlling additional pre-post spaces. Otherwise, you'd have to JavaScript.

    ------------------------------
    Joshua Whitener | Technical Advisor
    Exxon Mobil Corporation | 8326258441
    ------------------------------



  • 3.  RE: Composer or Web Service Trim

    Employee
    Posted 04-13-2020 09:41
    HI Scott

    normalizeSpace() is my go to .  I just tried it and it got rid of leading and trailing spaces, as well as extra spaces in between.  I'm not sure what you mean about removing spaces in an address.
    Before
    After

    Best Regards,
    Sigrid

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------



  • 4.  RE: Composer or Web Service Trim

    Posted 04-14-2020 09:00
    ASAP Utilities (add-on for Excel) does a great job for this type of thing and many other scenarios as well. 

    Thank you,
    Jack McGarry | Sr. Business Systems Analyst – SAP Finance | Airgas, an Air Liquide company
    610-781-1199 (Home Office/Cell) | jack.mcgarry@airgas.com 
    Find it with us, anytime, anywhere at Airgas.com






  • 5.  RE: Composer or Web Service Trim

    Posted 04-14-2020 11:23
    This is what I needed.  I should have tried the normalizeSpace option even though the description of the Function in Composer states "Removed whitespace from a text string".  I took it that it would remove all whitespace, not only extra ones.

    Thanks All!

    ------------------------------
    Scott Gorski
    General Mills | Data Analyst
    ------------------------------



  • 6.  RE: Composer or Web Service Trim

    Employee
    Posted 04-14-2020 11:59
    Glad it can help, Scott! :)

    ------------------------------
    Sigrid Kok
    PSE | Winshuttle NA
    ------------------------------