Skip to Content
avatar image
Former Member

how to typecast float value to Integer in C4C?

I am beginner in C4C development. I was trying to reverse a number. In Business object - I have created an element with data type Integer value (code snippet is below) and defined an action called as Reverse (Please refer Action Logic below) - every time when program enters into loop - the num value( num/10) is getting stored in float.

Kindly suggest how to convert this float value into interger.

*************LOGIC*******************

BO:

[Label("Enter Number:")] element num1:IntegerValue;

Action Reverse:

var num = this.num1; var revnum = 0;

while(num >= 1)

{

revnum = revnum * 10;

revnum = revnum + num%10 ;

num = (num/10);

} this.result = revnum ;

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 30, 2016 at 12:18 PM

    Hello Sumit,

    Looks like the compiler is defining the "num" variabel as a float.
    Please use this code:

    var num : IntegerValue;

    HTH,
    Horst

    Add comment
    10|10000 characters needed characters exceeded