Skip to Content
author's profile photo Former Member
Former Member

Aritmetics operations with UDFS

Could somebody help me with this problem? SBO 6.5

What data type works properly to make aritmetics operations? I have 2 UDF in OINV table and i want to multiplicate them and divide by 100. I've try many things but system doesn't send me any error.

Only i´ve obtained and error when udf's data type is "Units and Totals" subtype "Amount" and i've checked this select with many data types.

I have this select:

SELECT (($[OINV.U_DtoAHM] * $[OINV.U_ImpAnt)/100) FROM OINV T0 WHERE T0.DocNum=$[OINV.DocNum] FOR BROWSE

to calculate a new discount in the invoice card but SBO doesn't calculate it.

And a stranger behavior:

With numeric (integer, I think) data type i obtained next results:

SELECT (($[OINV.U_DtoAHM] * $[OINV.U_ImpAnt)/100) FROM OINV T0 WHERE T0.DocNum=$[OINV.DocNum] FOR BROWSE

Doesn't work.

SELECT ((1000 * $[OINV.U_ImpAnt)/100) FROM OINV T0 WHERE T0.DocNum=$[OINV.DocNum] FOR BROWSE

Works properly.

AND

SELECT (($[OINV.U_DtoAHM] * 1000)/100) FROM OINV T0 WHERE T0.DocNum=$[OINV.DocNum] FOR BROWSE

Works properly.

Incredible...

Alberto Hermida

Thanks.

Message was edited by: Alberto Hermida Mouriño

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jan 19, 2005 at 03:22 PM

    I had similar problems with formatted searches some time ago.

    I solved it casting the values obtained.

    Here you have a sample of a formatted search that works:

    SELECT CAST($[$38.U_PrixAch] AS numeric(19,6))/(1-CAST($[$38.U_TauxM] AS numeric(19,6)))

    Hope it solves your problem

    Trinidad.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      The syntax you are using for the variables is designed to return a string. There is an additional parameter '.NUMBER' you can use to get SBO to treat the variable as a numeric item. I have included a simple example below (assumes value of UDF is 5).

      SELECT $[ORDR.U_AZU_SPHR]

      - Treats it as a string: select '5'

      SELECT $[ORDR.U_AZU_SPHR.NUMBER]

      - Treats it as numeric: select 5

      This might solve your problem.

      Regards,

      John.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.