Normal Topic Need help with subform on Invoice Application (Read 1551 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Need help with subform on Invoice Application
Mar 27th, 2004 at 9:17pm
Print Post Print Post  
Since  subforms in Table View seem a bit akward to work in, I added some unbound elements in my parent form to make the data entry easier for the user. After entering data into these "temporary" fields, the user hits "add" button to "move" their data into a new record in the subform.
However, I cant figure out how to "post" my data from the unbound elements on the parent record  into "new records" in the subform. The new command "@createnewrecord" would be great to use, but I assume that will only create a new parent form, when what I need is to add the info to new "child records" as needed.

The programming I have in place is giving weird results.When I hit the "add button, its posting into wrong fields in the childrecord. No other feilds are being filled in, and I dont know how to start a new blank record for the next item.

Here's my prgramming for the add button (on element entry)

var vrecords as int

vrecords = @formresultsettotal("lineitems")

FormFieldValue("LineItems", "Stock no", vrecords, stock)
FormFieldValue("LineItems", "action", vrecords, action)
FormFieldValue("LineItems", "quality", vrecords, quality)
FormFieldValue("LineItems", "pattern", vrecords, pattern)
FormFieldValue("LineItems", "color", vrecords, color)
FormFieldValue("LineItems", "wide", vrecords, wide)
FormFieldValue("LineItems", "length", vrecords, length)
FormFieldValue("LineItems", "shape", vrecords, shape)
FormFieldValue("LineItems", "soldby", vrecords, sold by)
FormFieldValue("LineItems", "loc", vrecords, loc)
FormFieldValue("LineItems", "price", vrecords, price)
FormFieldValue("LineItems", "comments", vrecords, comments)
FormFieldValue("LineItems", "taxable", vrecords, taxable)
Readonly(quality,0)
readonly(pattern,0)
readonly(color,0)
readonly(wide,0)
readonly(length,0)
readonly(shape,0)
clear(stock, action, quality, color, pattern, wide)
clear(length, shape, sold by, loc, price, comments, taxable, li nu)
visibility(update, 0)
visibility(edit, 1)


Thanks, in advance for any suggestions.
Steve

  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with subform on Invoice Application
Reply #1 - Mar 27th, 2004 at 9:37pm
Print Post Print Post  
I think my problem may lie in the fact that all my "unbound" elements in the parent form are "text" fields.

Do these need to be BOUND in order to be changed to Number and money feilds? I didnt want the overhead of extra  feilds saved in the parent form.

Any thoughts?

thanks,
Steve
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Need help with subform on Invoice Application
Reply #2 - Mar 27th, 2004 at 10:14pm
Print Post Print Post  
To make a new subrecord to fill in, look at the new SBasic call provided in 1.0.2. @FormNewRecord. It is documented in the 1.0.2 Supplement. This call allows you to create a new record in a specific Form.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with subform on Invoice Application
Reply #3 - Mar 27th, 2004 at 10:19pm
Print Post Print Post  
Thanks. I forgot about that command.  I'll give it a try and post my results.

Thanks Erika..... again!

Steve
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with subform on Invoice Application
Reply #4 - Mar 27th, 2004 at 10:29pm
Print Post Print Post  
Erika,

Any idea why my above program is posting parent field data into the wrong child elements? Example: "quality" is posting into the "loc" field and "color" is going into the "Quality" field.

All the other fields in the child record are just remaining blank.

I tried "binding" the elements on the parent form to new text and number fields, but that doesnt make a difference.

Thanks
STeve
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Need help with subform on Invoice Application
Reply #5 - Mar 28th, 2004 at 1:04pm
Print Post Print Post  
In your child form - do you have any unbound or static LEs?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Warren_S.A
Member
*
Offline


No personal text

Posts: 15
Joined: Jul 8th, 2004
Re: Need help with subform on Invoice Application
Reply #6 - Jul 8th, 2004 at 5:34pm
Print Post Print Post  
I am completely lost on how do this -
I can even get the subform Table veiw to work properly.
I tried to enter directly into a table view but their is no Combo box In it.(So out of desperation I hard Code the Whole process) the problem is its getting very Code Heavy.

Any tips you can give me on how you did this will be welcomes.

Sincerly
Warren
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need help with subform on Invoice Application
Reply #7 - Jul 8th, 2004 at 7:02pm
Print Post Print Post  
Warren,

It looks like some posts from this topic are missing. Mark pointed out that there was a bug in table view subforms which HAS now been fixed, so make sure you are using ver 1.0.4.

In table view, you dont get the bells and whistles such as combo boxes, buttons, etc. you only get to see the fields and their data.

Since we wanted to use combo boxes and buttons, we set up all that info that the top of our parent form, just above the subform. Then, once all the combo boxes, check boxes, radio buttons, etc have been selected by the user, we have a button that 'moves' all the data down into the subform for permanent saving. (The data entered in the upper "data entry area" is all "unbound" and does not save when the user closes that record, but it DOES get saved when its moved down to the subform. I think its a great system, but it does require time to set up. (Maybe there is a better way to do this, but I dont know how).

The programming we use is "on element entry' when the user hits the "add to subform" button is something like:

var nn as int
nn=@formnewrecord("line items")

formfieldvalue("line items", "part number", nn, part number)
formfieldvalue("line items", "salesman", nn, @userid)
formfieldvalue("line items", "price", nn, sellingprice)
clear(part number, sellingprice)


Be sure to get the quotes in the right places (always tough for me)
Hope this helps. Smiley

Steve
  
Back to top
IP Logged