How can I get currency table ID by comparing currency table and MKT_Outstandings table. Value I need

How can I get currency table ID by comparing currency table and MKT_Outstandings table. Value I need

mftadminmftadmin Posts: 4Questions: 1Answers: 0
edited November 2022 in Editor
 using (var db = new Database(dbType, dbConnection))
            {
                var response = new Editor(db, "MKT_Outstandings")
                    .Model<MKT_Outstanding>()
                    .Model<CIS_Currency>()
                    .Field(new Field("MktOut_Customer")
                        .Validator(Validation.NotEmpty())
                    )
                    .Field(new Field("MktOut_Country")
                        .Validator(Validation.NotEmpty())
                    )
                    .Field(new Field("MktOut_SalesContract")
                        .Validator(Validation.NotEmpty())
                    )
                    .Field(new Field("MktOut_PurchaseOrder")
                        .Validator(Validation.NotEmpty())
                    )
                    .Field(new Field("MktOut_ShipmentDate")
                        .Validator(Validation.NotEmpty())
                    )
                    .Field(new Field("MktOut_Article")
                        .Validator(Validation.NotEmpty())
                    ).Field(new Field("MktOut_Fabric")
                        .Validator(Validation.NotEmpty())
                    ).Field(new Field("MktOut_PaymentTerms")
                        .Validator(Validation.NotEmpty())
                    ).Field(new Field("MktOut_TotalQty")
                        .Validator(Validation.NotEmpty())
                    )
                      .Field(new Field("MKTOut_Currency_ID")
                        .Options(new Options()
                            .Table("CIS_Currency")
                            .Value("currency_ID")
                            .Label("currency_Desc")
                        )
                     ).LeftJoin("CIS_Currency", "currency_Desc", "=", "MKTOut_Currency_ID")
                    // .MJoin(new MJoin("CIS_Currencies")
                    //    .Link("MKT_Outstandings.MKTOut_Currency_ID", "CIS_Currencies.currency_Desc")
                    //    .Field(new Field("currency_ID"))
                    //)
                    //.Field(new Field("MKT_Outstandings.CIS_Currencies")
                    //    .Options(new Options()
                    //        .Table("MKT_Outstandings")
                    //        .Value("MKTOut_Currency_ID")
                    //        .Label(new[] { "currency_ID" })
                    //    )
                    //)
                    //.LeftJoin("MKT_Outstandings", "MKT_Outstandings.MKTOut_Currency_ID", "=", "CIS_Currencies.currency_Desc")
                    .Field(new Field("MktOut_Rate")
                        .Validator(Validation.NotEmpty())
                    ).Field(new Field("MktOut_Amount")
                        .Validator(Validation.NotEmpty())
                    )
                    .TryCatch(false)
                    .Process(Request)
                    .Data();

                return Json(response);
            }

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • rf1234rf1234 Posts: 2,801Questions: 85Answers: 406

    I guess you cannot get an ID by "comparing" something. Using SQL you can SELECT an ID for example.

  • allanallan Posts: 61,436Questions: 1Answers: 10,049 Site admin

    How can I get currency table ID by comparing currency table and MKT_Outstandings table. Value I need

    I'm not actually clear on what the question is (or means). Are you asking how you can apply a condition to the data that is fetched from the server? If so this section of the manual covers it.

    Allan

  • mftadminmftadmin Posts: 4Questions: 1Answers: 0

    The issue has been resolved by using editor.inline ajax Thankyou !. The issue was that foreign primary key was not working with API controller. but it's resolved now

Sign In or Register to comment.