UCCX Script String Substring Function

I cannot use the Substring function to obtain a specific value from a string variable.
My substring position is variable, so I need to put a variable, loop and increment it the position.
When I try to add the below command, this is getting the error message:
Command: set STR_Resultado = STR_Valor.substring(P1,2+1)
Error message:
"Unable to parse expression; error while parsing string: STR_Valor.substring(P1,P2); nested exception is java.lang.NullPointerException"

To ask the obvious: do either P1 or STR_Valor have a null value at the time that step executes? If they do, this is the expected result. Use an On Exception Goto step or other preventative code to protect the step from this exception.
Why does your command and the error not match?
Command: substring(P1,2+1)
Exception: substring(P1,P2)
If the command statement is what you're actually using (your image attachment isn't showing) then I believe you have a syntax error. The substring method documentation doesn't suggest you can do additive operations here.
Most likely the first bullet though...
PS- You may want to get the length of the string first and ensure that the startIndex and endIndex are less than or equal to it. I believe you'll get a IndexOutOfBoundsException if you try to pull a substring from outside the bounds of the actual string.
Please remember to rate helpful responses and identify helpful or correct answers.

Similar Messages

  • "Subroutines" in an UCCX script

    My days as a former programmer are showing through. I always preferred structured code. So in that regard, does anyone have a mechanism for creating a pseudo subroutine inside a UCCX script? I realize that I can create a subscript and call it from my original script, but I really don't want to do that for the few lines of code I need to execute.
    I have a few lines of code that I need to execute from various points in my script. I'm looking for a mechanism to allow me to "call" that from a point in my script and then return to that point.
    I could set a string variable with a value that defines where I'm at within my script, and then use a switch statement based on that string variable with a bunch of goto statements that will return me to the proper point. What would be better is the capability to modify the destination of a goto statement based on the variable. Does anybody have any other suggestions?

    Sadly you cannot reference a variable within the Goto step. The way you can do this within the same script is to set a variable, Goto the function, and then check the variable value at the end of the function to decide where to return to. You can use a Match step to evaluate that variable and have a different Goto step within each case.
    You may also want to read up on Trigger Application method instead of using subflows. This was a great improvment introduced in CCX5+. My answer to another thread gave a crash-course explaination of why it's better:
    http://forums.cisco.com/eforum/servlet/NetProf?page=netprof&forum=Unified%20Communications%20and%20Video&topic=Contact%20Center&topicID=.ee6fe12&fromOutline=&CommCmd=MB%3Fcmd%3Ddisplay_location%26location%3D.2cd3f333

  • DB Read error from UCCX Script

    Hi All,
    We are running uccx 7.0.
    Trying to return data from DB using stored procedure from the uccx script.
    We are able to run this when we pass explicit value instead of variable ANI.
    But whenever we provide variable ANI, we get below
    error: SQL statement varible not defined : ANI
    Query which provided in the DB Read as below,
    select * from  table(credit_back.fun_select_point($ANI));
    Request your help on it..
    Regards,
    Shalid K.C

    Yes Gergely.
    we have created new script and when i add DB Read function in the script, it is not allow to apply it, same time it is giveing the above mentioned error.
    but when i test it with explicite value it is working.. .not working by providing variable name
    Regards,
    Shalid

  • Substr function? extracting just the records with 4 digits?

    have a column like this in a table
    SZSCAPD_SEC_SCHOOL_CEEB
    364775
    460460
    460240
    2562
    164625
    460240
    230969I need to be able to retrieve just the values with 4 digits like 2562 and add 00 at the front, so it will ended like 002562
    I am thinking in the substr function, but it won't work, because I will be extracting the first 4 digits of each number.
    How I will do this? I want to only retrieve the numbers with 4 digits Then I will concatenate the 00 in front.
    Thank you

    Hi,
    peace4all wrote:
    ... How I will do this? I want to only retrieve the numbers with 4 digits One way to do that is
    WHERE   TRANSLATE ( szscapd_sec_school_ceeb
                , '123456789'
                , '000000000'
                ) = '0000'
    Then I will concatenate the 00 in front.
    '00' || szscapd_sec_school_ceebThis assumes that szscapd_sec_school_ceeb is a string.
    If szscapd_sec_school_ceeb is a positive number, and you want to ignore any fractional part, use
    WHERE   szscapd_sec_school_ceeb     >=  1000
    AND     szscapd_sec_school_ceeb <  10000to find the numbers and
    TO_CHAR (szscapd_sec_school_ceeb, 'FM000000')to display them as 6 digits, with leading 0's.
    Edited by: Frank Kulash on Aug 20, 2010 11:01 AM
    Added NUMBER alternative.

  • How to see programming Code for UCCX Script

    Hi All,
    How can I  see the programming Code for UCCX Script? I have a script and want to see its Code , something like :
    int sum = 0;
    boolean alternate = false;
    boolean isValid = false;
    try {
    int i = 0;
    for (i = ccnumber.length() - 1; i >= 0; i--) {
      int n = Integer.parseInt(ccnumber.substring(i, i + 1));
      if (alternate) {
       n = n * 2;
       if (n > 9) {
        n = (n % 10) + 1;
      sum += n;
      alternate = !alternate;
    isValid = (sum % 10 == 0);
    } catch (Exception e) {
    return -1;
    return (isValid == true ? 1 : 0);
    thanks,
    Hamed

    You're not going to find code per se, unless you have some java class you wrote and then you would only see the code if you had the source java file.  The script is the only interface you get for "code".
    david

  • Substring function not working in Analytical view

    Dear All,
    I am trying to use substring function in my analytical view .It says valid expression during syntax check but getting activation error.
    thanks
    Sourav

    Hi Krishna,
    This is Kiran, I am trying to restrict a (string) filed value by removing the spaces and wring to calculated column field in an Analytical view for position 6 - 10.
    Example: Field name XYZ (Values showing as: ASDFG GETVALUENW  2345) --> (data type :22 VARCHAR)
    Output Value must be : GETVALUENW (which is 10 characters, from position 6 after trimming)
    Please advice which function use and how to apply the syntax
    Your inputs are highly appreciated.
    Thanks
    Kiran.

  • Substring Function without the length!

    I know I have seen this before, but cannot find it when searching.
    I need to do something similar to the Substring function, where I start from position 4, but the length behind this position is variable.   Due to the IDOC it only passes the value...
    I think I possibly saw a UDF for this somewhere - unless I can use some standard mapping!
    It is probably very simple - but it is late in the day and my eyes are square!  = )
    <i> I need a drink......</i>
    Can anyone help?
    Message was edited by:
            Barry Neaves

    For substring function, you have 1 input and 2 parameters (you set the parameters by double-clicking the function box).
    I also didn't understand how you can pass the output of length function two 2nd parameter of substring function (since it is a parameter and not an expected input).
    You could always create a UDF...
    public String UDSubstring(String a,String b,String c,Container container){
      int d = Integer.parseInt(b);
      int e = Integer.parseInt(c);
      if ((e == 0) && (a.length() >= d)) {
        return a.substring(d);
      else if ((e > d) && (a.length() >= e)) {
        return a.substring(d, e);
      else return "";
    They don't bite, you know...
    Regards,
    Henrique.
    <b>Edit:</b> followed by Michal's correction...

  • Substring function in HFR

    Hello Experts,
    Iam a rookie in HFR. I needed to know how to implement the Substring functionality in Hyperion. Can anyone throw some light on this?

    thats a major drawback of hyperion financial reporting of not having any string functions. as per my knowledge there is none.
    Let me know if you get to know of the same. Coz even I need it for couple of things in my reports.
    regards,
    rahul

  • Using substring function with error

    Hi Guys,
    I have a source field with 1200 characters which need to map to multiple target segments for  132 count of this source field.
    This is not a mandatory field so it sometimes come without any value.
    I am using substring function to breakout the string for every 132 characters and mapped to the target segments.
    There are two problems, first it seems that if source is blank, there will be error.
    Second, if source field come with only eg. 300 characters, error will also occurs.
    I have searched thru SDN and try some of the UDF but to no avail.
    Appreciate your guidance on this problem.
    Regards
    FNG

    H Rahul,
    I have tried your quote but face some syntax error as follows
    Function calculate, Line 6:
    cannot find symbol symbol  : method length() location: class java.lang.String[] j = input.length();       
    Function calculate, Line 26:
    cannot find symbol symbol  : method subString(int,int) location: class java.lang.String[]           
    result.addValue(input.subString(0,EndIndex));                                      ^
    Function calculate, Line 34:
    cannot find symbol symbol  : method subString(int,int) location: class java.lang.String[]                result.addValue(input.subString(StartIndex,EndIndex));                                              ^
    Function calculate, Line 40:
    cannot find symbol symbol  : method subString(int,int) location: class java.lang.String[]                result.addValue(input.subString(StartIndex,EndIndex));                                              ^ Note: /usr/sap/D03/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd66a3a60002911e09ba9e41f132d6b68/source/com/sap/xi/tf/_MM_MT_COMS_TO_ZME_CRE_CHG_CONTRACT_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /usr/sap/D03/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd66a3a60002911e09ba9e41f132d6b68/source/com/sap/xi/tf/_MM_MT_COMS_TO_ZME_CRE_CHG_CONTRACT_.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors

  • Convert substring function from SQL Server to Oracle

    I am converting a large application written for SQL Server to Oracle and have encountered a difference in how the substring function is called between the two database systems.
    In SQL Server:
    select substring('xyz'1,2)
    In Oracle:
    select substr('xyz',1,2)
    Is there a way to establish a user-defined operator to map the substring call to a substr call so I don't have to change the application code?
    Is the user-defined function a way to do this?
    Which is better?

    If you want to be able to use the code that has substring in it, without modifying it, and have it do the same thing as substr, then try running the script below. It will create a user-defined function named substring that will cause substring to act like substr.
    CREATE OR REPLACE FUNCTION substring
    (p_string IN VARCHAR2,
    p_start IN VARCHAR2,
    p_end IN VARCHAR2 DEFAULT NULL)
    RETURN VARCHAR2
    IS
    v_string VARCHAR2 (100);
    BEGIN
    IF p_end IS NULL
    THEN
    SELECT SUBSTR (p_string, p_start)
    INTO v_string
    FROM DUAL;
    ELSE
    SELECT SUBSTR (p_string, p_start, p_end)
    INTO v_string
    FROM DUAL;
    END IF;
    RETURN v_string;
    END substring;
    null

  • Substr function fails

    hi there, can anyone tell me why a simple substr would throw an error if the target varchar assignment isn't three characters larger than the length provided to the substr function?
    can anyone tell me why this:
    declare
    v_legal varchar2(200);
    v_disp_trans_sid integer := 850500;
    begin
    v_legal := SUBSTR(Ttls_Common.build_parcel_string(v_disp_trans_sid),1,200);
    dbms_output.put_line('v_legal is '||length(v_legal)||' characters.');
    end;
    causes this even though the assignment is substr to 200:
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 7
    yet once i increase the size of the target varchar by three characters it works:
    declare
    v_legal varchar2(203);
    v_disp_trans_sid integer := 850500;
    begin
    v_legal := SUBSTR(Ttls_Common.build_parcel_string(v_disp_trans_sid),1,200);
    dbms_output.put_line('v_legal is '||length(v_legal)||' characters.');
    end;
    causes:
    v_legal is 200 characters.
    PL/SQL procedure successfully completed.

    user521233 wrote:
    my character set:Yes, UTF8 is multi-byte. Now check NLS_LENGTH_SEMANTICS:
    select value from nls_session_parameters where parameter = 'NLS_LENGTH_SEMANTICS';Most likely it is set to BYTE. If so, as I already noted, you can explicitly specify:
    v_legal varchar2(200 char);or you can set lenght semantics for your session to characters instead of bytes
    ALTER SESSION SET NLS_LENGTH_SEMANTICS=CHAR;or you could set it to CHAR once for the instance:
    ALTER SYSTEM SET NLS_LENGTH_SEMANTICS=CHAR;and bounce th instance.
    SY.

  • Substring function giving out empty fields

    I am using OAS 10.1.3v . I have a problem with the substring function in the BPEL functions. In 10.1.2v , all the xpaths with substring functions gave out data.
    But in 10.1.3v, all those nodes are seen empty. Is there any particular reason for this ?
    Is this a problem of any particular jar file ? I am using xalan 2.7.0 along with this, for custom functions.
    Also, in which class, inside the jar file, is the substring function defined ?

    Try wrapping the substring function in a @member function. You need the ruturn of a member name not a string. Look at the example of @member in the technical reference for more details

  • SubString Function Help

    Hello -
    I have the below string and need help with substring function.
    String: AMERICAS\JOHN_NOLAN
    1st Output Achieved: JOHN_NOLAN
    Code used for 1st Output:
    UPPER(SUBSTRING(ASSOC_NTWK_LOGIN,CHARINDEX('\',ASSOC_NTWK_LOGIN)+1,LEN(ASSOC_NTWK_LOGIN) - CHARINDEX('\',ASSOC_NTWK_LOGIN)))
    2nd Output Needed: AMERICAS (From the string)
    Please help.
    SS

    Hi,
    Please try below solution:
    CREATE TABLE #SUB
    ASSOC_NTWK_LOGIN VARCHAR(50)
    INSERT INTO #SUB(ASSOC_NTWK_LOGIN)
    VALUES
    ('AMERICAS\JONH_NOLAN');
    SELECT UPPER(SUBSTRING(ASSOC_NTWK_LOGIN,CHARINDEX('\',ASSOC_NTWK_LOGIN)+1,LEN(ASSOC_NTWK_LOGIN) - CHARINDEX('\',ASSOC_NTWK_LOGIN))) AS NAME
    ,UPPER(SUBSTRING(ASSOC_NTWK_LOGIN,0,CHARINDEX('\',ASSOC_NTWK_LOGIN))) AS LOGIN_NM
    FROM #SUB
    Regards,
    Reshma
    Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered

  • LabView String StartsWith functionality like in C#?

    Hello all,
    in C# (.NET) there is a good class: String
    There it is possible e.g. to get information, if the string startswith a special substring.
    Is there such possibility in LabView? Is there such LabView vi, which offers this functionality? (Some snippet?)
    Why I am asking:
    I want to create a switch/case-block (case-structure) in labview for this code:
    if(string.startswith("XYZ"))  step into case1
    else if(string.startswith("DEF")) step into case2
    BTW:
    It would be so nice if anybody could create polymorphic VI with these functions: 
    (from C# string class)
    public object Clone();
    public static int Compare(string strA, string strB);
    public static int Compare(string strA, string strB, bool ignoreCase);
    public static int Compare(string strA, string strB, StringComparison comparisonType);
    public static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture);
    public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options);
    public static int Compare(string strA, int indexA, string strB, int indexB, int length);
    public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase);
    public static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType);
    public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture);
    public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options);
    public static int CompareOrdinal(string strA, string strB);
    public static int CompareOrdinal(string strA, int indexA, string strB, int indexB, int length);
    public int CompareTo(object value);
    public int CompareTo(string strB);
    public static string Concat(IEnumerable<string> values);
    public static string Concat<T>(IEnumerable<T> values);
    public static string Concat(object arg0);
    public static string Concat(params object[] args);
    public static string Concat(params string[] values);
    public static string Concat(object arg0, object arg1);
    public static string Concat(string str0, string str1);
    public static string Concat(object arg0, object arg1, object arg2);
    public static string Concat(string str0, string str1, string str2);
    public static string Concat(object arg0, object arg1, object arg2, object arg3);
    public static string Concat(string str0, string str1, string str2, string str3);
    public bool Contains(string value);
    public static string Copy(string str);
    public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count);
    public bool EndsWith(string value);
    public bool EndsWith(string value, StringComparison comparisonType);
    public bool EndsWith(string value, bool ignoreCase, CultureInfo culture);
    public override bool Equals(object obj);
    public bool Equals(string value);
    public static bool Equals(string a, string b);
    public bool Equals(string value, StringComparison comparisonType);
    public static bool Equals(string a, string b, StringComparison comparisonType);
    public static string Format(string format, object arg0);
    public static string Format(string format, params object[] args);
    public static string Format(IFormatProvider provider, string format, params object[] args);
    public static string Format(string format, object arg0, object arg1);
    public static string Format(string format, object arg0, object arg1, object arg2);
    public CharEnumerator GetEnumerator();
    public override int GetHashCode();
    public TypeCode GetTypeCode();
    public int IndexOf(char value);
    public int IndexOf(string value);
    public int IndexOf(char value, int startIndex);
    public int IndexOf(string value, int startIndex);
    public int IndexOf(string value, StringComparison comparisonType);
    public int IndexOf(char value, int startIndex, int count);
    public int IndexOf(string value, int startIndex, int count);
    public int IndexOf(string value, int startIndex, StringComparison comparisonType);
    public int IndexOf(string value, int startIndex, int count, StringComparison comparisonType);
    public int IndexOfAny(char[] anyOf);
    public int IndexOfAny(char[] anyOf, int startIndex);
    public int IndexOfAny(char[] anyOf, int startIndex, int count);
    public string Insert(int startIndex, string value);
    public static string Intern(string str);
    public static string IsInterned(string str);
    public bool IsNormalized();
    public bool IsNormalized(NormalizationForm normalizationForm);
    public static bool IsNullOrEmpty(string value);
    public static bool IsNullOrWhiteSpace(string value);
    public static string Join(string separator, IEnumerable<string> values);
    public static string Join<T>(string separator, IEnumerable<T> values);
    public static string Join(string separator, params object[] values);
    public static string Join(string separator, params string[] value);
    public static string Join(string separator, string[] value, int startIndex, int count);
    public int LastIndexOf(char value);
    public int LastIndexOf(string value);
    public int LastIndexOf(char value, int startIndex);
    public int LastIndexOf(string value, int startIndex);
    public int LastIndexOf(string value, StringComparison comparisonType);
    public int LastIndexOf(char value, int startIndex, int count);
    public int LastIndexOf(string value, int startIndex, int count);
    public int LastIndexOf(string value, int startIndex, StringComparison comparisonType);
    public int LastIndexOf(string value, int startIndex, int count, StringComparison comparisonType);
    public int LastIndexOfAny(char[] anyOf);
    public int LastIndexOfAny(char[] anyOf, int startIndex);
    public int LastIndexOfAny(char[] anyOf, int startIndex, int count);
    public string Normalize();
    public string Normalize(NormalizationForm normalizationForm);
    public string PadLeft(int totalWidth);
    public string PadLeft(int totalWidth, char paddingChar);
    public string PadRight(int totalWidth);
    public string PadRight(int totalWidth, char paddingChar);
    public string Remove(int startIndex);
    public string Remove(int startIndex, int count);
    public string Replace(char oldChar, char newChar);
    public string Replace(string oldValue, string newValue);
    public string[] Split(params char[] separator);
    public string[] Split(char[] separator, int count);
    public string[] Split(char[] separator, StringSplitOptions options);
    public string[] Split(string[] separator, StringSplitOptions options);
    public string[] Split(char[] separator, int count, StringSplitOptions options);
    public string[] Split(string[] separator, int count, StringSplitOptions options);
    public bool StartsWith(string value);
    public bool StartsWith(string value, StringComparison comparisonType);
    public bool StartsWith(string value, bool ignoreCase, CultureInfo culture);
    public string Substring(int startIndex);
    public string Substring(int startIndex, int length);
    public char[] ToCharArray();
    public char[] ToCharArray(int startIndex, int length);
    public string ToLower();
    public string ToLower(CultureInfo culture);
    public string ToLowerInvariant();
    public override string ToString();
    public string ToString(IFormatProvider provider);
    public string ToUpper();
    public string ToUpper(CultureInfo culture);
    public string ToUpperInvariant();
    public string Trim();
    public string Trim(params char[] trimChars);
    public string TrimEnd(params char[] trimChars);
    public string TrimStart(params char[] trimChars);
    Eugen Wiebe
    Bernstein AG
    CLAD - Certified LabView Associate Developer
    Solved!
    Go to Solution.

    Why I am asking:
    I want to create a switch/case-block (case-structure) in labview for this code:
    This can be done already with the case structure, you can do simple parsing in the case selector, which takes a string as an input.
    Type into the case for first case "XYZ....XYZ~"
    Type into next case "DEF...DEF~"
    Next case is empty string, default.
    How does this work:
    The "XYZ...XYZ~"  matches all strings that start with XYZ and have any ascii value after the ~ is the highest printable 7bit ascii value so this catches all other characters.
    Option 2 is parse (there are very good reg expression vi in the string palette) the string and create interger value if a matched then habdle the unique integers in the case structure.
    There are so many ways to do it without making a wrapper for the .net string class, I provided a few quick methods
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • SAP XI - Using the substring function.

    Hi Experts,
    I am having trouble using the substring function in SAP+XI. I have to consider the value from characters 6 to 19 for a target field of 25 characters. Every time I ma using the standard substring function it is giving an error Array Out of Bounds Exception.
    Please tell me how to proceed.
    Thanks
    Aniruddha

    Hi,
    Above error wil come if the input string length is less than the substring length what you are trying to get..
    i.e length of the input string is less than 25 characters... do some validations or pass substring as 6 and 0 ..
    HTH
    Rajesh

Maybe you are looking for

  • Converting sales order into a XML file

    Hai....friends.... I am tring to send an sales order as iDOC to a xml port in the same application server.... 1. have created a xml port with path..\usr\sap\RRM\SYS\global\. 2. assigned it to logical system. 3.Have a RFC destination of TCP/ip(LOCAL_E

  • WiFi iPhone 4S does not work after update iOS 6.0

    WiFi iPhone 4S does not work after update iOS 6.0

  • Open links from other apps in Private Browsing

    When other Android apps open links in the default web browser, Firefox Mobile launches them in a normal new tab. How can I force these links to open in Private Browsing?

  • Wireless network printing from macbook to windows XP

    We have a wireless router (netgear) setup with 3 XP computers. A canon i900d printer is directly connected to the main computer. All computers share the internet and printer perfectly. I have the macbook recognizing the network and sharing the intern

  • Premiere Pro Refuses to Load the Correct Clip.

    Oh man, Premiere has been hosing my projects with extreme prejudice and causing me to seriously question my sanity. Here's what's going on. I open an existing project and scrub through a sequence only to find that certain clips in the sequence seem t