Join

Join

prietorafael57prietorafael57 Posts: 3Questions: 1Answers: 0

Hello, I am having problem with join no id column,

Error
DataTables warning: table id=IM_ItemVendor - Requested unknown parameter 'IM_ItemVendor.VendorNo' for row 0, column 0.
Join to tables no ID column, same column name oh both tables

Editor::inst( $db, 'IM_ItemVendor', 'VendorNo' )
->fields(
Field::inst( 'VendorNo' ),
Field::inst( 'ItemCode' ),
Field::inst( 'LastReceiptDate' )
->validator( Validate::dateFormat( 'D, j M Y' ) )
->getFormatter( Format::dateSqlToFormat( 'D, j M Y' ) )
->setFormatter( Format::dateFormatToSql( 'D, j M Y' ) ),
Field::inst( 'LastLeadTime' ),
Field::inst( 'LastReceiptPurchaseOrderNo' )
)
leftJoin( 'AP_Vendor', 'AP_Vendor.VendorNo', '=', 'IM_ItemVendor.VendorNo' )

Answers

  • mimi123456789mimi123456789 Posts: 15Questions: 1Answers: 0

    Hello,

    I don't understand your probleme, can you show the js or explain your table please ?

  • rf1234rf1234 Posts: 2,991Questions: 87Answers: 421

    Since you are joining two tables with identical column names you must use the respective table name as a prefix in your field instances.
    e.g. Field::inst( 'IM_ItemVendor.VendorNo' )
    etc.

  • prietorafael57prietorafael57 Posts: 3Questions: 1Answers: 0

    Hello I try it but keeps error

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    On the client-side I suspect you currently have:

    data: 'IM_ItemVendor.VendorNo'
    

    for the column. Change it to just be:

    data: 'VendorNo'
    

    You only need the table name if you had also specified it in the field at the server-side.

    Allan

This discussion has been closed.