Creating dataports with multiple tables

ebednezebednez Member Posts: 22
Can a dataport be created using multiple tables? Also, is there any good ducmentation on the subject? An example would be the Sales Shipment Header table and the customer table. I would want to export shipment information but include the customer name by linking the customer number in both tables.

Thanks,

Ed

Comments

  • SavatageSavatage Member Posts: 7,142
    edited 2007-06-04
    The Sales Shipment Header already contains a field called "Name" which contains the customer name.
    FYI..
    if you are familiar with GET'S
    Using just the Sales Shipment Header as a dataitem......
    you could use a get like Customer.GET("Sell-to Customer No.");

    then assign a variable to the field you want to export
    PaymentTerms := Customer."Payment Terms Code";

    then put the variable name in the dataport field list to export.

    I haven't tried it but it sounds good on paper :lol:
  • SavatageSavatage Member Posts: 7,142
    note: the Application Designers Guide has a whole section on Dataports.
    It can be found on the product cd.
  • emulsifiedemulsified Member Posts: 139
    I have a dataport that does that. I needed one a while back that let me do wildcard filtering on Item Category Code because I had a lot of categories that were similar but too large to specify using the normal method (drop-down linked to Item Category Code table).

    I ended up creating a dataport on table Item Ledger Entries and using Customer.GET("Source No.") in the OnBeforeExportRecord() trigger to get my customer record details so I could have them in my CSV output along with all of the individual details I needed about their purchases for another project partner client doing promotions.

    So when running my dataport I simply used whatever filters I needed at run-time.

    FYI if you're not familiar with this you can get the related data you need by specifying a Global Variable Name:Customer, Type:Record, Table:Customer
    Create global variables for the data you wish to GET from the customer record accordingly:
    CustomerName
    CustomerAddress
    etc...

    Then under OnBeforeExportRecord you would add:

    Customer.GET("Source No.");
    CustomerName := Customer.Name;
    CustomerAddress := Customer.Address;
    
    etc...

    Under Dataport Fields:

    CustomerName
    CustomerAddress
    etc...

    Hope this helps. I've learned a lot here since 2007, this forum has saved me many headaches. Good luck.
    Half-empy or half-full how do you view your database?

    Thanks.
  • SavatageSavatage Member Posts: 7,142
    Just as an addition the ILE source # can be a vendor # if type purchase & blank if positive or neg adjustment.
    so just to insure no crashing you can wrap that code just a bit to stop any headaches.
    if Customer.GET("Source No.") then begin
    CustomerName := Customer.Name;
    CustomerAddress := Customer.Address;
    end;
    
  • emulsifiedemulsified Member Posts: 139
    Good idea. Never had any issues because I always apply entry type SALE and only ever made sales to customers only.

    Thanks. I've modified my reports accordingly.
    Half-empy or half-full how do you view your database?

    Thanks.
Sign In or Register to comment.