Forum Navigation
You need to log in to create posts and topics.

Formatted Search - Convert Fraction to Decimal

This query takes data form the Marketing Row field "Free Text" and converts the fraction to decimal. The logic is this query is extraordinary, and can be extremely helpful for those companies running SAP Business One who must deal with fractions. Construction companies and the like.

Example: Open a Sales Quotation and using the "Form Settings" expose the field "Free Text". Of course you can rename this field, or even use a different one. Just be sure to adjust he query to use whatever field you want. This query then converts a fraction keyed into an alphanumeric field into a decimal. BAM! It's awesome.

SELECT CAST(CAST(SUBSTRING($[$38.163.0], 1, LOCATE($[$38.163.0],' ')-1) As float) + (CAST(SUBSTRING($[$38.163.0], LOCATE($[$38.163.0],' ')+1,LOCATE($[$38.163.0],'/') - LOCATE($[$38.163.0],' ')-1) as float) / CAST(SUBSTRING($[$38.163.0], LOCATE($[$38.163.0],'/')+1,LENGTH($[$38.163.0]) - LOCATE($[$38.163.0],' ')-1) as float)) As char) As Quotient FROM dummy