function for binary

function for binary

  

Hi


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?

Cheers

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.