cancel
Showing results for 
Search instead for 
Did you mean: 

Quanity Field - add sign in front

silentbull
Participant
0 Kudos

Hi,

I have a proxy to jdbc scenario. I have declared both of them as string.

When i get Qty field from SAP i am getting it as 250.00-.

This is giving an error in jdbc since the original database expects to have sign in the front.

Can anyone let me know how to resolve this. If udf is the only way, please give me the udf as i am pretty new to java as well.

Regards

Sam

Accepted Solutions (1)

Accepted Solutions (1)

rcsegovia
Active Participant
0 Kudos

One more option

cheers,

Roberto.

Answers (1)

Answers (1)

manigram
Active Participant
0 Kudos

Hi,

250.00- this number is not negative number, minus symbol precent in last digit so PI taking this as a string digit. If it is minus number ask the source team to send value like this -250.00. then you can use neg function to convert as positive number.

another way to achive this is use replaceString method to replace the minus symbol. once you remove this it will act as a integer.

Regards,

Manigandan

former_member184789
Active Contributor
0 Kudos

Hi,

If the requirement is such that you will need a - before the number i.e -222 if a - exists i.e -222 or 222- and if there is no -, such as 222 then populate as it is, then have below UDF with single values:

String Str = "";

if(var1.indexOf("-")!=-1)

        {

            var1 = var1.replaceAll("-", "");

           

            Str = "-"+var1;

        }

        else

          Str = var1;

       

    }

return Str;