Jredeemer14 Posted July 19, 2008 Posted July 19, 2008 I'm trying to develop a good way to add shipments with around 60 new inventory items to my inventory table. I figured A custom dialog box with a script to create the new records would be a good start. Alright I need to delveop a custom script that will: First: popup with a custom dialog box that asks for how many new records and the invoice Number(it would be the same for every new record) and create those records. Second: Then it creates however many new records I put in and they are all filled with the same invoice number. If anyone has seen a better way to add bulk new records to a table then I'm open to suggestions. Any help would be appreciated. Thanks - Jeff
tachyon Posted July 21, 2008 Posted July 21, 2008 I'm no gun but it seems to do what you asked [color:red] New Record/Request Show Custom Dialog [ Title: “add new”; Message: “enter number of records and inv number”; Buttons: “OK”, “Cancel”; Input #1: invoice::number of records, “number of new records”; Input #2: invoice::inv no, “inv no” ] Set Variable [ $nnr; Value:1 ] Copy [ invoice::inv no ] [ Select ] Delete Record/Request [ No dialog ] Loop New Record/Request Paste [ invoice::inv no ] [ Select ] Set Variable [ $nnr; Value:$nnr+1 ] Exit Loop If [ $nnr > invoice::number of records ] End Loop you can have a layout that it swaps to at the end of the script that doesn't include the number of records field. the top bit makes a new record to receive the input, copies the inv no and deletes the record - this is because it makes one extra record if you leave the first one in. Your number of records field is global.
Mike J Posted July 21, 2008 Posted July 21, 2008 (edited) Show Custom Dialogue (Option to input data- your global field) If (Get (Lastmessagechoice)=1) Go to Layout (Inventory) Go to record (first) OmitMultiple (Get (FoundCount) Loop Exitloopif (Isempty (GlobalField) or GLobal Field <= 0) New Record Request Set Field (Your Primary Key for the relationship) Set Field (ANY OTHER DATA) Set Field (Your Global) (Your Global -1) EndLoop Else If (Get (LastmessageChoice)=2 Commit Record Request Halt Script End If Go to original Layout Commit Record Request This would be my base script. I would add others depending upon the options/questions users may have. M The cool thing at the end of this...since the found set is your new records... [color:blue]ReplaceFieldsContents is great for processing a bunch of records at once. (Make sure you test this a lot before implementing. Edited July 21, 2008 by Guest
bcooney Posted July 21, 2008 Posted July 21, 2008 (edited) It seems odd to me that you are creating bulk records. What is the business process? An order becomes an invoice? Invoice line items become shipment line items? Or, are items invoiced only after shipment? My gut instinct says that you need a line items table. The same line items can be used for orders/invoices/shipments. Maybe even an interface to select line items for relation to a shipment record. Edited July 21, 2008 by Guest Consolidate Line Items into one table
Mike J Posted July 21, 2008 Posted July 21, 2008 That all depends on the OP need. If you needed to set up a periods and intervals for the same parent record (i.e. Treatments that happen on different dates) then bulk record creation is the correct method. If it is invoicing with line items then I would not pursue the bulk record creation. So it just depends on the context of the original post.
bcooney Posted July 21, 2008 Posted July 21, 2008 I agree there's a time and place for bulk record creation (calendaring systems a key example), but the OP mentions inventory and shipments. Sometimes I just answer the question asked, but I feel that in this instance it'd be a disservice, since it seems the OP needs help with his data model (and doesn't know it).
Recommended Posts
This topic is 5969 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now