Can i anyone help me out to get correct esq query for

SELECT

[Account].[Name] 

FROM

[dbo].[Order] 

LEFT OUTER JOIN [dbo].[Account] ON ([Account].[Id] = [Order].[AccountId] )

WHERE ([Order].[Id]='10643C0B-4932-415C-9150-91458492BBBE')

My esq query:

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {rootSchemaName: "Order"});

                        

esq.AddColumn("[Account:Id:AccountId].Name");

                        //esq.addColumn("Name");

                        

var FirstFilter = esq.createColumnFilterWithParameter

                        (Terrasoft.ComparisonType.EQUAL,"Id", this.get("UsrPONo").value );

esq.filters.add("first", FirstFilter);

                        

 esq.getEntityCollection(

                        function(result) {

                            if (result.success) {

    //assigning collection to the variable

                                var items = result.collection.getItems();

                                

                                var name = items[0].values.Name;

                                    this.set("UsrAccount",name);

                            }

                                

                        }, this);

 

I could not get the name of the account using this.

Like 0

Like

5 comments

Can anyone help on this?

Hi Susanna,



Seems like you have added a wrong column.



Correct column in the query will be:

esq.AddColumn("Account.Name");



Here you can find more samples. Its about C#, but logic is the same.



Regards,

Dmytro

Dmytro,

I tried it is not working.I need to join the two tables Account and Order, retrieve the account name.

Please correct the esq

 

Can anyone help on this?

Susanna Thomas,

Can you show us the console.log.



You want get the column account in order. The account is lookup from Order, no need "esq.AddColumn("[Account:Id:AccountId].Name");", just esq.AddColumn("Account"); and you will get the Id and Name of Account.

Then, when getting the result, set UsrAccount this.set("UsrAccount", {value: ..., displayValue: ...}); if the UsrAccount is lookup, else if string, just get displayValue

Show all comments