Question

substring and cast in esq

I have column in object called "Lead no" in format- "L_". I want to get the maximum value of integer value in the same through esq.

SQL query of something like this:

SELECT MAX(CAST(SUBSTRING("UsrName",3,length("UsrName")) AS DECIMAL)) FROM "UsrLead"

can someone help me on this?

Thanks

 

Like 0

Like

1 comments

Hi Gokul, 

 

Here are some examples how you can implement it : 

 

1. By using direct SQL queries 

 

https://customerfx.com/article/executing-direct-sql-statements-in-a-pro…

 

2. By using "Select" class 

 

https://academy.creatio.com/documents/technic-sdk/7-15/retrieving-infor…

 

3. By using client side logic (but modifying this code according to your business logic) example below

 

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

 

esq.addColumn("Account.UsrINN", "AccountINN");

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

column.orderDirection = Terrasoft.OrderDirection.ASC; 

 

esq.rowCount=1; 

 

esq.filters.addItem(esq.createColumnFilterWithParameter(3, "Account.UsrINN", "7730616959")); 

 

esq.getEntityCollection(function (result) {

    if (result.success && result.collection.getCount() > 0) {

        var item = result.collection.getByIndex(0);

        var INN = item.get("AccountINN");

        var modOn = item.get("ModifiedOn");

    }

}, this);

 

 

P.S. Please refer the post below about ESQ access rights, that could be also useful for you 

 

https://community.creatio.com/questions/access-issue-esq

 

 

Show all comments