Normal Topic Field Type dilemma (Read 799 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Field Type dilemma
Aug 28th, 2009 at 11:23pm
Print Post Print Post  
SOLines - ItemQty field.   I do not want trailing zeros to be visible (1.00 instead of 1  invites mistakes  when loading trucks and invoicing) on the sales order tik.  And sometimes we will break a carton of something, and so I need to be able to enter .5 or .75 into that ItemQty field, so it's set to be a Text field. 

But I do want to be able to run reports that sum the cumulative quantity of an Item Number (or Item Numbers for a particular client).   But the Report Wizard won't give me the option of summing the ItemQty field because it's set as text, not a number.

Any suggestions?
  

Larry
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Field Type dilemma
Reply #1 - Aug 29th, 2009 at 2:26am
Print Post Print Post  
The field must be a number to do math.

On some reports like packing slips, make them display Integer value if they are a whole number, else display two digits. 

Divide the field by its integer value.
If no remainder it is a whole number so display as Integer. 
If there is a remainder, it is a fraction so use normal display of number with 2 digits.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Field Type dilemma
Reply #2 - Aug 29th, 2009 at 3:02pm
Print Post Print Post  
Hi Bob,  thanks for your reply.

I can see where you're pointing, but I can't see how to get there from here.

I may not have been clear about how I'm using the form and then the report.  My packing slip (delivery ticket) is the form itself printed (not a report).  So the display in the Form is the dog (no trailing zeros), and the report is the tail (do math on the ItemQty values), in priorities.

I want to sum quantities when I run reports, so the Form element must be defined as a number.  But, in the Formview, I do not want a decimal and trailing zeros displayed 'unless' the quantity is a fraction  (so that if the quantity is '2', it doesn't display as 2.00, but if the quantity is .75, then it displays as .75).

I was hoping I could convert the text value of the form element to a number value in the report programming, and thus execute math on that data for report purposes.  (Secondarily, I played around with @decimals and @str, positing that I could have the ItemQty field display no zeros if a whole number, but fractions when there are fractions, on element exit ... just rookie thrashing around).  But if I set the field to allow two decimals, it (with me at the helm, anyway) insists on displaying the two trailing zeros even with whole numbers.


  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Field Type dilemma
Reply #3 - Aug 29th, 2009 at 3:07pm
Print Post Print Post  
I just had a thought (yippee!)    Could I have the normal ItemQty field be a text field (solving my 'no zeros display' requirement on the delivery ticket), and have a hidden ItemQtyShadow field on the form that would "= the ItemQty field", with this shadow field being a 'number' field.  Thus I would use the shadow field in reports for 'number and math' purposes, but get the display I want in the regular Form view?   Any holes in that (besides maybe being a little clumsy)?
  

Larry
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Field Type dilemma
Reply #4 - Aug 29th, 2009 at 5:31pm
Print Post Print Post  
I added ItemQtyShadow field as a number field, mass updated this field to @TN(ItemQty), and tested it with some reports.  Seems to have solved my problem.

Am I missing something with this 'fix' that's going to trip me up down the road?
  

Larry
Back to top
IP Logged