Skip to Content
avatar image
Former Member

User Defined Function issue

Hi, I have created a user defined function in message mapping and it works fine as it is but now the customer wants to changes something and I don't know how to implement it.

My current code which works:

String INVTnegCT="1";

String INVTposCT="2";

if (a.equals("INVTnegCT")

{

return INVTnegCT;

}

else {

return "INVTposCT";

}

But they want me to change neg/pos to -/+ for example INVTposCT to INVTCT but it seems that I can't use -/ in the function. is there a way to do it?

thanks for response!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 24, 2009 at 12:08 PM

    No we cannot. It's a violation of language constructs.

    But I am wondering what is the necessity of defining variable like that as you are returning their value not the variable name itself.

    I think may be they are asking you for this

    String INVTnegCT="INVT-CT";//modified here
    String INVTposCT="INVT+CT";//modified here
    
    if (a.equals("INVTnegCT")
    
    {
    return INVTnegCT;
    }
    
    else {
    return "INVTposCT";
    }

    Edited by: Praveen Gujjeti on Mar 24, 2009 5:39 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Praveen Gujjeti

      Thank you! that solved my problem 😊 I know i Could do graphical mapping but there were too many strings to handle..1 and 2 where just an example. there were between 15-20 different strings so it was easeir by user defined function.

      thanks for all the answers guys!

  • avatar image
    Former Member
    Mar 24, 2009 at 12:09 PM

    do onething

    declare and assign string pos = "+" and neg ="-"

    then return these strings based on the logic you write instead of earlier things

    otherwise concat strings with needed fied andsend the response

    if not clear for you post the exact req in detail

    Rajesh

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 24, 2009 at 12:25 PM

    Hi

    Do you need to pass either of INVT-CT or INVT+CT as return value.

    If it is so, please check the below code.

    String strneg ="INVT-CT";

    String strpos ="INVT+CT";

    if(a.equals("INVTnegCT")

    {

    return strneg;

    }

    else {

    return strpos;

    }

    Thanks

    Prasad Nemalikanti

    Add comment
    10|10000 characters needed characters exceeded