Page 1 of 1

check if a parameter value is numeric

Posted: Wed Oct 02, 2019 9:09 pm
by manu0521
Pass a cell value from excel to tm1 ti process.

User can enter any value and submit an action button , in ti ,I have to check if the passed value is numeric .

Is there a function in tm1 which can check if the parameter value is numeric.

Thanks,

Re: check if a parameter value is numeric

Posted: Thu Oct 03, 2019 1:19 am
by tomok
manu0521 wrote:
Wed Oct 02, 2019 9:09 pm
User can enter any value
Not if you apply data validation in Excel.

Re: check if a parameter value is numeric

Posted: Fri Oct 04, 2019 4:25 am
by macsir
Better than nothing :D

Code: Select all

SCAN( SUBST( vsVar, 1, 1 ), '0123456789' ) <> 0

Re: check if a parameter value is numeric

Posted: Tue Jun 30, 2020 3:58 am
by Alex Leung
Set the parameter as string type first, then add checking as below:

Code: Select all

IF( vsVar @= NumberToString( NumBr ( vsVar)) );
#Is Numeric
Else;
#Not;
EndIf;
Alex

Re: check if a parameter value is numeric

Posted: Tue Jun 30, 2020 9:35 am
by Mark RMBC
Hi,

I would think Tomok's suggestion is the way to go, but

Cant you just do the check in Excel, so have a formula along the lines of:

=IFERROR(A1*1,0)
=IF(A2=0,0,1)

Then have a parameter in the TI called pIsNumeric (1 or 0) and have the action button point at this cell?

regards,
Mark

Re: check if a parameter value is numeric

Posted: Tue Jun 30, 2020 3:08 pm
by gtonkin
Or you could use =ISNUMBER() assuming you are not using TM1 Web.

Re: check if a parameter value is numeric

Posted: Tue Jun 30, 2020 4:17 pm
by Mark RMBC
Yes, I originally had isnumber in my comment but then thought it is probably for the web so changed it!

Re: check if a parameter value is numeric

Posted: Wed Jul 01, 2020 2:31 am
by Andy Key
You still need to change it if you're on 2.0.6 or earlier.

IFERROR only got TM1Web support in 2.0.7.

Re: check if a parameter value is numeric

Posted: Wed Jul 01, 2020 7:50 am
by Mark RMBC
Yes, and in that case just use if iserror!

regards, Mark

Re: check if a parameter value is numeric

Posted: Fri Jul 03, 2020 10:41 am
by orlando
manu0521 wrote:
Wed Oct 02, 2019 9:09 pm

Is there a function in tm1 which can check if the parameter value is numeric.

here's my idea.
Why don't you store the value in a cube (eg. Value_Input) per user.
For example, the cube could have the dimensions }Client and Measure_Input.
The elements for the input are created in the dimension Measure_Input.
Instead of passing the value to the process, the user and the element from Measure_Input are passed to the process.
The process then collects the value form the cube.
This ensures that no nonsense goes to the process and you can see what exactly the user entered last.
The input cube can of course have other dimensions, it was just a quick idea.

best regards
orlando