I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad…@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
Make sure that height_dia_inch is of type Data and height_dia is if type float.
When you enter value in height_dia_inch as a fraction. The code will set its decimal value in height_dia.
I have tried this code. Maybe you didn't clear cache.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
You are correct Nabin, I was missing the quotes in my code and also referring it with doc, thanks alot for the same. But this has given rise to another question that is I am unable to use the following code since math is not defined.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
You are correct Nabin, I was missing the quotes in my code and also referring it with doc, thanks alot for the same. But this has given rise to another question that is I am unable to use the following code since math is not defined.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
Math.round will round the number to nearest integer. It won't round the number to nearest decimal.
If you want to restrict output to 2 decimals, use flt(val, 2)
Sent from my phone
On 20-Apr-2013, at 4:17 PM, Aditya Duggal <ad...@gmail.com> wrote:
You are correct Nabin, I was missing the quotes in my code and also referring it with doc, thanks alot for the same. But this has given rise to another question that is I am unable to use the following code since math is not defined.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
OMG I would really have to get used to the case sensitivity of coding. Thanks a lot for pointing out this silly mistake.
On Saturday, April 20, 2013 4:20:08 PM UTC+5:30, Nabin Hait wrote:
It should be Math.round(), case sensitive.
On 20-Apr-2013, at 4:17 PM, Aditya Duggal wrote:
You are correct Nabin, I was missing the quotes in my code and also referring it with doc, thanks alot for the same. But this has given rise to another question that is I am unable to use the following code since math is not defined.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
For introducing me to flt but I have already done the calculation in the round to get me 3 decimal places. Once again thank you all for the help.
On Saturday, April 20, 2013 4:22:41 PM UTC+5:30, Anand Doshi wrote:
It should be Math with M capital.
Math.round will round the number to nearest integer. It won’t round the number to nearest decimal.
If you want to restrict output to 2 decimals, use flt(val, 2)
Sent from my phone
On 20-Apr-2013, at 4:17 PM, Aditya Duggal <ad…@gmail.com> wrote:
You are correct Nabin, I was missing the quotes in my code and also referring it with doc, thanks alot for the same. But this has given rise to another question that is I am unable to use the following code since math is not defined.
By any chance, are these fields located in a table? The code I have given works for main form and doesn't work in table. It would be different for table.
Sent from my phone
On 20-Apr-2013, at 3:39 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
Thanks for the quick response, I have tried the below code replacing the requisite quotes but there seems to be nothing happening, do I need to call this function from another function or it should work without being called. The part of code I am using is below:
On 20-Apr-2013, at 11:07 AM, Aditya Duggal <ad...@gmail.com> wrote:
Hi,
I have been trying to figure out a way to capture data which is in fraction but honestly cannot really figure out which field to use and how to keep fractional and decimal data in the database.
Now my problem is that I am trying to capture some dimensions and as all of you might be aware that dimensions can be in various units but in my industry the dimensions are either in mm or inch.
Now till now we are capturing all the data in mm and not in inch we generally convert the inch data manually but this creates a lot of trouble. Now entering mm data is simple which happens to be a float but when it comes to Inch data capturing we are talking about fractions as well. Is it possible to capture the data in a form in Inch aka fractions and then save both the data in the table.
For example: we need to enter 1/2" then there are 2 ways of doing it:
Easier way: Make a form with float input field and ask the user to convert the fraction into decimal and then enter the data.
Benefit of this method is only one which is less coding for the developer.
Tougher way: Make a form with FRACTION input field and ask the user to enter the fraction only, now there would be another field in decimal which would be hidden from the user and the code would be run to convert the fraction to the decimal and both the values would be saved.
Now my question is that how could be handle such a situation in erpnext.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.