I'm trying to understand the tables for the transa...
# suitescript
s
I'm trying to understand the tables for the transaction tables, Is there a table for the transaction main line and a separate table for transaction lines with forgien key of other table per line ?
what makes it even more confusing is this simple query the id is it "internalidnumber" ,"id" "internalid"
Copy code
let myCustomerQuery = query.create({
        type: query.Type.TRANSACTION,
      });
       let a = myCustomerQuery.createCondition({
         fieldId: "id",
        operator: query.Operator.EQUAL,
        values: id,
      })
s
Are you using the Records Catalog? Go to Setup -> Records Catalog (it's the last thing in the list), if not
s
yes
that answers the 2nd question
s
Yes the transactionLines are a join
s
maybe idont know what im doing but i dont see that
Copy code
Transaction
s
If you are on the records catalog, there is a tab for all the fields, and a tab for all the joins. The catalog tells you the field id needed for the joins, you will see transactionLines under the joins. You can click on transactionLines and see the fields that are available
s
yes that is where im looking
Copy code
custrecord_tranchild_join
message has been deleted
this is my fake sql that im trying to get working
Copy code
SELECT *
FROM transaction
INNER JOIN transactionline ON transaction.ID = transactionline.transactionID;
s
I dont see transactionline.transactionID in the records catalog, so I am not sure why you think that is the way to join
message has been deleted
s
i dont think that is true that was fake sql
just how my braining is working
my current code
Copy code
et myCustomerQuery = query.create({
        type: query.Type.TRANSACTION,
      });
      myCustomerQuery.join({ fieldId: "transactionLines" });
      let a = myCustomerQuery.createCondition({
        fieldId: "id",
        operator: query.Operator.EQUAL,
        values: id,
      });
    myCustomerQuery.condition = myCustomerQuery.and(a);

      myCustomerQuery.columns = [
        myCustomerQuery.createColumn({ fieldId: "billoflading" }),
        myCustomerQuery.createColumn({
          fieldId: "id",
        }),
      ];
      let resultSet = myCustomerQuery.run();
      log.debug("test", resultSet.results);
s
One thing I have seen as a problem here is this set of lines
Copy code
myCustomerQuery.join({ fieldId: "transactionLines" });
      let a = myCustomerQuery.createCondition({
        fieldId: "id",
        operator: query.Operator.EQUAL,
        values: id,
      });
you need to something like this
Copy code
let newvar = myCustomerQuery.join({ fieldId: "transactionLines" });
newvar.createCondition({
        fieldId: "id",
        operator: query.Operator.EQUAL,
        values: id,
      });
it looks like you are trying to create the join using the same name as the query.