Where Condition in EntitySchemaQuery

Dear Team,

Please help me below sql raw query 

select top 1 Data from UsrCandidateDocumentsFile where Id='c35275e3-145d-4988-9604-5a54702e0fac' order by modifiedOn desc

the above query converted into in EntitySchemaQuery.

Regards,

Sekhar.

 

Like 0

Like

1 comments

Dear Sekhar,

Please see an example of the code below:

                                    // esq

                                                var esq = Ext.create("Terrasoft.EntitySchemaQuery",{

                                                                rootSchemaName : "UsrCandidateDocumentsFile"

                                                });

                                                esq.addColumn("Data");

                                var FirstFilter =     esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,

"Id", "c35275e3-145d-4988-9604-5a54702e0fac");

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

                                                var ModifiedOnColumn = esq.addColumn("ModifiedOn");

                                                ModifiedOnColumn.orderDirection = Terrasoft.OrderDirection.DESC;

                                                esq.getEntityCollection(function(result){

                                                                if (result.success){

                                                                                var first = result.collection.first();

                                                                                // process the first element

                                                                }             

                                                }, this);

 

Additionally, please find more information about esq in the articles by the links below:

https://academy.creatio.com/documents/technic-sdk/7-15/entityschemaquery-class-filters-handling

https://academy.creatio.com/documents/technic-sdk/7-15/entityschemaquery-class-adding-columns-query

https://academy.creatio.com/documents/technic-sdk/7-15/entityschemaquery-class-getting-query-result

Best regards,

Norton

Show all comments