26
Views
6
Comments
Integer to Boolean
Question
Application Type
Mobile
Service Studio Version
11.10.7 (Build 37469)
Platform Version
11.11.0 (Build 26567)

Hi everyone,

I have a checkbox and the value type to assign is a Integer but checkbox only accepts boolean i've tried to convert the field but no success

IntegerToBoolean(GetStocks.List.Current.Stock.iva1incl)

Can this be done?


Thanks in advance.

iva.jpg

Rank: #55

Hi David,


You can express this boolean in a form of a condition.

If you want the value greater than 0 to be the True, otherwise False, your condition should be


GetStocks.List.Current.Stock.iva1incl > 0


Regards,
João


Champion
Rank: #377

Hi David,

By saying that the value type to assign is an integer, you probably mean a 1 or a 0?
In the database booleans are stored as a bit, a 1 or a 0. When you query the data, Outsystems converts this to a boolean. In an advanced query, you can assign that to a boolean field in the output structure.
So maybe you should change the structure such that you've got a boolean value to assign the the checkbox.

To just answer your question: No, you cannot put it like that. The Variable needs to be a boolean.


Regards,
Lennart

Rank: #34687

Hi Lennart,

I've tried to change the structure to boolean but when i do that i got and error in the bootstrap server action.


Regards

David

Champion
Rank: #377

Excel uses TRUE or FALSE in the fields (if you've an English version) to manage booleans.
So when using a bootstrap then you need to put those there as boolean values.

If that's not possible, you can edit the bootstrap yourself and change the integervalue to a boolean in the record by putting something like Value = 1

Rank: #34687


My excel returns 0 or 1 i've tried to convert the field in the bootstrap but no success, any ideas?

Rank: #55

Hi David,


Like Lennart pointed out, if you have your structure attribute from the excel as an Integer and your attribute value in Boolean, you can convert it by checking if the integer value from Excel is 1, something like this:


Example OML in attachment.

TestImportBoolean.oml