Automic Workload Automation

  • 1.  Remove last character of a String

    Posted Feb 19, 2018 09:39 AM
    Hi,

    Can someone help me get past a problem?

    I am using a script object that retrieves a list of workflows that should have active periods in Activities Window. To do that, the script makes use of a VARA.SQLI object. The values retrieved by the VARA are then included in a report:

    :SET &HND2#=PREP_PROCESS_VAR(VARA.SQLI.PERIODS_REPORTS_2ND_CHECK)
    :PROCESS &HND2#
    :   SET &RET2# = GET_PROCESS_LINE(&HND2#,1)
    :   PRINT "Check for extra/missing periods in Activities Window: &RET2#"
    :ENDPROCESS


    All good, but i need to remove the last character from the values retrieved and I could not find a way around this. As an example,the results of the script are added in a report and sent in an email as attachment but the output looks like this:

    2018-02-19 10:03:09 - U00020408 Remove this period from Activities Window: JOBP.UC4_CHECK_BILLY
    2018-02-19 10:03:09 - U00020408 Check the following missing periods in Activities Window: JOBP.IN_WIP_ISSUE_RTN_INB_ERP_NSK_C4

    I basically want to get rid of the last character from the bolded value. This means that i would like to use a script function to remove that last character from &RET2#

    For now I tried using STR_CUT,MID,SUBSTR but with no results. Is there a simple way to achieve this?

    Thank you!



  • 2.  Remove last character of a String
    Best Answer

    Posted Feb 19, 2018 09:42 AM
    Hi MihailCheie604746

    Maybe you can determine the string's length (and store it in a variable) in order to subsequently use STR_CUT.

    You can use STR_LENGTH for that.

    Example:
    :SET &LENGTH# = STR_LENGTH(&RET2#)
    :SET &LE# = &LENGTH# - 1
    :SET &RET2_SHORT# = SUBSTR(&RET2#, 1, &LE#)

    Hope this helps,
    Antoine



  • 3.  Remove last character of a String

    Posted Feb 19, 2018 10:11 AM
    Thank you, Antoine!

    It worked great and now everything looks right!

    Cheers,

    Mihail