
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ensure only numbers are used as input in 'Variable input' object
how can i ensure that only numbers are input and not text or any characters in 'Variable input'
If any text or char is used set the variable to 1.
How can we do this
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, of course if the content of a variable is a string then needs the variable-call be adjusted. In your case maybe like:
if(isnum(num#('$(MyVar)')) or num#('$(MyVar)') = 0, 1, num#('$(MyVar)'))


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In QV there are options to enforce only certain values and especially the possibility to provide (calculated) value-lists from which the user could select the wanted value is very useful. I don't know if Sense has similar features.
Beside this you could query the variable-value and reacting on it, maybe like:
sum(Value) * $(=rangemin($(MyVar), 1))
and/or:
if(isnum($(MyVar)), 'MyVar = ' & $(MyVar), 'invalide value in MyVar')
and showing it within a title or any text-box and/or using isnum($(MyVar)) as a calculation-condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @marcus_sommer , isnum() or istext() or isnull() shows error as I input nothing or any 'xyz' string in the input string.
I want to let the user input an exchange rate ,if the user puts nothing or zero or any string in that case i want the variable to be set to 1 ,so that wherever i have used that variable as a division i can see proper values.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, of course if the content of a variable is a string then needs the variable-call be adjusted. In your case maybe like:
if(isnum(num#('$(MyVar)')) or num#('$(MyVar)') = 0, 1, num#('$(MyVar)'))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @marcus_sommer , I tweaked your solution to meet my needs ,this is the working expression
if(not isnum(num#('$(vEuroRate)')) or num#('$(vEuroRate)') = 0 or isnull(num#('$(vEuroRate)')), 1, num#('$(vEuroRate)'))
The first one is to handle any text in the input box ,second is to handle 0 and the third is to handle null
