• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

C-BSFN Convert String to Numeric

coolkl

Active Member
Requirement: Convert String to Numeric in C

In C BSFN, I have added following Logic:

Retrieved the Description 1 from UDC and it works. This description is number of days. So I want to convert this string to Numeric and then use for calculation. I have define a string variable to retrieve description from UDC and then a integer ((Even tried Math Numeric) for conversion.

Using ParseNumericString(szNumericDays, szDaysString);

I get following warnings on compiling - Warnings:
'LPMATH_NUMERIC' differs in levels of indirection from 'int'
'ParseNumericString' : different types for formal and actual parameter 1

Any suggestions, or any other API to use ?

Thanks,
KL
 

jdelisths

Reputable Poster
Do this:

MATH_NUMERIC mnTest;

ParseNumericString(&mnTest, szDaysString);



You can also do this:

int i = 0;

i = jdeAtoi(szDaysString);
 

coolkl

Active Member
Thanks Hari for reply. Can you explain the second part how to convert to integer. int i = 0? What is the API to convert jdeAtoi ?? Is this a API. I now realize i need the value in int, so this option works. Appreciate your help.

Or Is there a way to convert MathNumeric to Int.

Thanks Very Much.
 

BOster

Legendary Poster
Its basically the JDE wrapper around the standard C call atoi. You can do that with pretty much all the JDE string calls (with the exception of a few that "behave" differently), just take off the "jde" and search for help on that call or if you find a string call you want to use, add "jde" to the beginning of it and chances are it will work. For documentation purposes I like using MSDN but there are a ton of other sources.
 
Last edited:

jdelisths

Reputable Poster
Brian answered your jdeAtoi question.

There is an API to convert MathNumeric to Int. It is MathNumericToInt and you can use it like this:

int number = 0;
MathNumericToInt(mnNumber, &number);
 

coolkl

Active Member
Thanks everyone. Yes I found jdeAtoi in B4200310 and used it. It works great. Thanks for your help.
 
Top