Hi folks,
I'm trying to figure out a way to import purchase invoices from a CSV that has header information and line information on the same line, such as
VendorID, VendorInvoice, InvoiceDate, Department, GL Accout, Quantity, Amount
I have set up an XMLport to the point where it will create a Purchase Header record for each line in the CSV, but I'm not sure how to (or if I can) get it to treat certain fields as belonging to the Header and others the line. Also of course the line would need to get the same order number as the header...
And one more thing... say I want to populate a field in the Header or Lines table with a value that isn't in the table... I presume I'd have to do that in code but which trigger (and what code!)?
Thanks for any help,
Chandler
0
Comments
Play around with it, and see if you can figure it out
RIS Plus, LLC
There are a couple of things I'm still missing though: first, I can't figure out how to modify a field in the xmlport table... for instance, I want to set the Document Type to Invoice for each imported row.
At this point in testing (I'm not even worrying about the lines right now, just the header) my XMLport, taking into account fields that don't need inserting into the Purhcase Header) looks like this:
Node Name Node Type Source Type Data Source
Root Element Text <Root>
PurchHdr Element Table <Purchase Header>(Purchase Header)
ColumnNo Element Text <ColumnNo>
VendName Element Text <VendName>
VendID Element Field <Purchase Header>::Buy-from Vendor No.
ThirdParty Element Text <ThirdParty>
InvDate Element Field <Purchase Header>::Posting Date
My flat file looks like this:
,Approved Invoices - Date Range + 3rd Party (AMD) 3/12/12 Thru 3/19/12,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,
,Law Firm Office, VENDOR ID,If Applicable - 3rd Party Payable To,Invoice Date
18,"Buzzard & Hawke LLP, Nairobi",10000,,3/7/2012
7,Banks & Allen PLLC - Athens,20000,,3/7/2012
8,Banks & Allen PLLC - Athens,20300190,,3/8/2012
12,"Smith & Jones, LLC, Sparta",01254796,,3/9/2012
,Total,,,,,,,,,,,,,,,,,"$35,418.41 ",,,
I figured out how to skip the first three header lines... in PurchHdr - Import::OnAfterInitRecord I do this:
I am creating Purchase Header records... but I can't find where to put the code for setting the new record's Document Type. If I refer to 'PurchHdr; or 'Purchase Header' or <Purchase Header> in the code it doesn't recognize it, nor does it like 'Rec'. Creating a separate record variable for Purchase Header doesn't seem to me like it will refer to the proper table. Any thoughts?
Also, I think I will need to grab the Document No. value from the newly created Purchase Header record to put on the lines... that I guess is really the same question as the Document Type: How to refer to the Import table in code?
Thanks again...
Try different things, see if you can make it work. Figuring out how to do stuff like this is what it means to be a developer.
RIS Plus, LLC
Put CrazyBryan in the Node name and see if you can use that. Put HelloWorld in the angle brackets and see if that works. Try it with and without the quotation marks. By using unique names like that you should be able to figure out which one you can use in the code.
RIS Plus, LLC
Thanks for your patience... I'll keep beating on it.
Do you have a senior that can show you how to do stuff like this?
RIS Plus, LLC
Enjoy: http://youtu.be/qNYrmZXUOxE
RIS Plus, LLC
RIS Plus, LLC