Is there a direct way without to create in purpose a function to deliver the binary of an integer number? I have never seen any buit-in function to parse/convert  an integer number to binary in OS. Such a common conversion and it seems we need to set the function by ourselves... i would like to have a built-in function already ready to be used... like integertobin(number). The integertoboolean() does not serve the purpose of course.

Hello Jorge,

I do not know of any "built in" function to convert an integer to binary.
Not only. I never had the need to use such a function. 

Could you explain what do you need to do?
Like, why do you need to convert an integer to binary?


Eduardo, I will need a binay number, because a very important information sits in the second digit from the right  of such binary. I have solved it doing a function in sql server studio that writes the binary of the several integers to a new column. In this way I can use this information to do the logic in OutSystems. I have created a trigger (in sql server Management studio) to update any new integers (along with other information) that come to the table and converts the integer to bin and writes it in the binary column. In OS I consult this table and can retrieve the binary number and do a simple logic with substring. :)

So, you are telling that a BINARY digit is important? Like

00000010 => this one? The 1 or 0 at the second digit of the integer of value?

yep, it tells an important information for the user account control. :) it means a disable account in your case. :)  

I'm keen to know if this is possible within OS as well. I have a source database that stores device status in integer format. Once converted to binary, each bit represents the status of hardware. For instance, the number 67 is stored in the database converts to 1000011 as binary, and when those bits are referenced (right to left), the first indicates if the device is in service or not. The second might represent the printer.

So for me, being able to convert 67 to its binary representation will allow me to determine the device status. I've done this easily in PHP previously, but is there a way in OS?

Hi Mike,

I've just published a component on the forge to make the bitwise operators available in OutSystems.

You can also get from the forge a sample application that uses it.

Hope this helps.


I just posted a component in the forge to run php scripts.

You can use this way:



 $decString = '26';

 $binString = base_convert($decString,10,2); // = '11010'

 echo $binString;




@Silvio: I don't think PHP is installed on most servers running OutSystems, so even though perhaps it works on yours, it's bound to fail on most others. Also, it's extremely convoluted and bound to be very, very slow. Also, the topic is pretty old, so the answer is pretty useless...

EDIT: For future reference, to get bit N (base-0) of an integer without bitwise operators, divide the number by 2^N, then use Mod(value, 2) to extract the right-most bit (which after the division is the Nth bit of the original number).