How can I pass a callback function to GetEntityCollection function of ESQ? 

Like 0

Like

1 comments

Please debug the function in the developers console in google chrome. Once you find how it works, you'll be able to find how to pass the parameter. Additionally, you can search for the examples with the global search trough all sources in the google developers console.

Show all comments

Can I know how I can create insert queries and execute those using esq on the detail? 

Like 1

Like

7 comments

You can use the InsertQuery client-side. Here is a sample: 

var insert = Ext.create("Terrasoft.InsertQuery", {
	rootSchemaName: "UsrMyEntity"
});
 
insert.setParameterValue("UsrMyParentId", this.get("Id"), Terrasoft.DataValueType.GUID);
insert.setParameterValue("UsrMyDateProperty", new Date(), Terrasoft.DataValueType.DATE);
 
insert.execute(function() {
	// do any refreshing if needed here
}, this);

Ryan

Ryan Farley,

Great! this helps. Is there a way I can do bulk insertion of multiple records at 1 single time? Any documentation reference would be really helpful. 

Thank you

 

kumar,

To do any sort of insertions of multiple records, I would create a configuration service and call that instead from the client. It would be far more efficient that way.

Ryan

Ryan Farley,

Hi guys, that is helping me in another implementation. Is it also possible to use it as updateQuery?

Thanks.

Danilo Lage,

Yes, an UpateQuery is similar, see the following sample:

var update = Ext.create("Terrasoft.UpdateQuery", {
	rootSchemaName: "Contact"
});
 
update.filters.add("IdFilter", update.createColumnFilterWithParameter(
	Terrasoft.ComparisonType.EQUAL, "Contact", this.get("UsrContactId")));
 
update.setParameterValue("UsrSomeField", "value", Terrasoft.DataValueType.TEXT);
update.setParameterValue("UsrSomeId", someId, Terrasoft.DataValueType.GUID);
 
update.execute(function() {
	// do any needed refreshing here etc
}, this);

Ryan

Danilo Lage,

kumar,

Please see the following articles, there you can find instructions on building update, insert, delete and batch queries. 

https://academy.bpmonline.com/documents/technic-sdk/7-13/dataservice-ad…

https://academy.bpmonline.com/documents/technic-sdk/7-13/dataservice-up…

https://academy.bpmonline.com/documents/technic-sdk/7-13/dataservice-ba…

https://academy.bpmonline.com/documents/technic-sdk/7-13/creating-detai…

The examples are done using C# language in case you decide to create a web service. Also there is a JavaScript example. They are particularly the same in the syntax. There also you can find examples of cases using insert, update, delete and batch queries.

Hope you will find it helpful.

Regards,

Anastasia

Ryan Farley,

Thanks, Ryan!

 

Anastasia Botezat,

Great, Anastasia...

Show all comments

what I mean is how to apply the concept of angluar js 1.x directives on custom lookup in bpm, so wirte the code of custom lookup once and add it to multiple pages.

Like 0

Like

2 comments

Use mixin   A good example of mixin allows add multi-currency field

Hello.

The mixin would indeed be a decent way to achieve the desired functionality.

Best regards,

Matt

Show all comments

I really need to solve this question , even a part of them

-Create new filter “Attention” in the Activity section grid page (near Owner and Date filters). When turned on, only overdue activities and high priority 

 today activities should be displayed. Filter should use current user time zone.

 (using code and not filter manually)

Like 0

Like

2 comments

In ActivitySectionV2 do it by analogy with this example

1) Create new filter near Owner and Date filters

{

    "operation": "insert",

    "parentName": "IsActiveFiltersContainer",

    "propertyName": "items",

    "name": "IsActiveCheckbox",

    "values": {

        "bindTo": "IsActive",

        "caption": "Активные",

        "controlConfig": {

            "className": "Terrasoft.CheckBoxEdit",

            "checkedchanged": {

                "bindTo": "onIsActiveCheckboxChecked"

            }

        }

    }

}

2)

getFilters: function () {

    var sectionFilters = this.callParent(arguments);

    this.setIsActiveFilter(sectionFilters);

    //this.setCommunicationFilter(sectionFilters);

    return sectionFilters;

},

setIsActiveFilter: function (filterCollection) {

    var isActive = this.get("IsActive");

    if (isActive) {

        if (!filterCollection.contains("IsActiveFilter")) {

            filterCollection.add("IsActiveFilter", this.Terrasoft.createColumnIsNullFilter("Account"));

        }

    } else {

        filterCollection.removeByKey("IsActiveFilter");

    }

},  

onIsActiveCheckboxChecked: function (value) {

                if (!this.get("IsSectionVisible")) {

                    return;

                }

                this.set("IsActive", value);

                this.sandbox.publish("FiltersChanged", null, [this.sandbox.id]);

                this.reloadGridData();

            },       

3)Add atribute "IsActive"

attributes: {

      "IsActive": {

          "dataValueType": this.Terrasoft.DataValueType.BOOLEAN,

          "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

           "value": true

            },

        }

}

Hello!

Please see a comment from Grigoriy above, this would help you implement your idea.

Matt

Show all comments

Question :

On the Product edit page, develop a new button or action for calculating product popularity. Popularity is calculated as the ratio of the number 

 of products in invoice records that contain the current product, to the total number of products in invoice records. Display the calculation result 

 as a percentage using the message window.

how to solve it by esq?

Like 0

Like

1 comments

Dear Mohamad,

Please see the ESQ example below. The method can be triggered by the button click on th product page.

checkProductNumber: function() {
				var currentProduct = this.get("Id");
				var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "InvoiceProduct" });
				esq.addColumn("Product");
				esq.filters.add("Product", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "Product", currentProduct));
				esq.getEntityCollection(function(response) {
					if (response && response.success) {
						var quantity = response.collection.collection.length;
						if (quantity > 0) {
							var esq1 = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "InvoiceProduct" });
							esq1.addColumn("Id");
							esq1.getEntityCollection(function(result) {
								if (result && result.success) {
									var total = result.collection.collection.length;
									this.showInformationDialog(quantity / total);
								}
							}, this);
						} else {
							this.showInformationDialog("This product is not indicated in any invoice.");
						}
					}
				}, this);
			}

Hope you will find it helpful.

Regards, 

Anastasia

Show all comments

 Please help with this question :

Configure settings so that a user cannot save an invoice if the total amount of a customer's debt (taking into account the amount of the current invoice) exceeds $4,000.

 

what this mean and how to solve it?

Like 0

Like

1 comments

Hello, what you described is an object logic (validation) than can be both created and deleted with code only by a skilled developer.

In many cases our customers implement similar logic purposefully.

If you need our help in resolving this case, please, let us know. 

Show all comments

Hi everyone,



I have query:

SELECT (
	SELECT
		count(DISTINCT(c.id))
	-- c.id, c.name
	FROM flight_detail fd
		JOIN contact c
			ON c.id = fd.contact_id
		WHERE
			-- get last year 
			(fd.departure_date >= '2016-09-01' AND fd.departure_date <= '2017-09-30')	
			AND
			-- get this year
			fd.contact_id IN (
				SELECT fd_ly.contact_id
				FROM flight_detail fd_ly
				WHERE 
					fd_ly.departure_date >= '2017-09-01' AND fd_ly.departure_date <= '2018-09-30'
			)
) AS 'Customer Last Year Who Still Buy Ticket This Year',
(
	SELECT
		count(DISTINCT(c.id))
		-- c.id, c.name
	FROM flight_detail fd
		JOIN contact c
			ON c.id = fd.contact_id
		WHERE
			-- get last year 
			(fd.departure_date >= '2016-09-01' AND fd.departure_date <= '2017-09-30')
) AS 'Customer Last Year';

How to transform query to JSON format for sending data paramater DataService.

This query for get data from bpm and I want show the result to my 3rd app.



Thanks.

Like 0

Like

1 comments

Dear Romadan,

Not all queries can be easily translated in a single DataService request. In the most complex cases consider refactoring a query into few smaller queries and sending them one by one storing the result from first query and passing it as a parameter to the next query. 

Show all comments

Hi Community!

How are you?

How could I put together a query similar to that with ESQ on the server side? Can I use aggregation functions?

 SELECT Max(l.CreatedOn), l.SmrRecordId 

   FROM SmrLoggingRecord l

     JOIN [dbo].[Case] c

        ON l.SmrRecordId = c.Id

        AND c.UpriEstadoCasoId = '78346E42-83AD-4790-B901-DB750A1D157E'

  WHERE l.SmrColumnCaption = 'Estado del Caso' 

  GROUP BY SmrRecordId

King Regards!

Ezequiel

 

 

Like 0

Like

1 comments

Hi,

There is good description here how to write such queries. When reading pay attention to "Adding columns to query" section there. You can not only use aggregation in queries but also can use aggregation in filters

Show all comments

Hello, 

I am trying to do something like this:

Grab information to current page, based off of value in Lookup field.

Example would be, on the current page when the User (Contact) lookup is filled in, also grab the contacts Address (String value), Phone Number (String value), and Account name (Lookup value) and fill it in on the current page. 

I am fairly sure I need to run a client side ESQ, and a few joins to get the information I am looking for, but I have not been successful yet. 

Any help is appreciated!

Like 0

Like

1 comments

Please investigate how to work with ESQ

https://academy.bpmonline.com/documents/technic-sdk/7-11/use-entitysche…

Then check the article by the link below. It shows how to select aggregate data.

https://community.bpmonline.com/questions/esq-query-find-role

Then check the next article. There you'll find how to fill in a lookup value. 

https://community.bpmonline.com/questions/update-query-change-lookup-va…

If you want to set a text or integer value, you need to use the following syntax:

this.set("fieldname", value); in a replacing client module.

Please find more information about modules in the article by the link below.

https://academy.bpmonline.com/documents/technic-sdk/7-11/adding-calcula…

Show all comments

Hello community!

I need get the title of the column form ESQ. The query not have the tile localization.

How can get it? Any function or ESQ query to have that?

 

Regards,

 

Like 0

Like

3 comments

It should be something like this

var userConnection = Get<UserConnection>("UserConnection");

var activityQuery = new EntitySchemaQuery(userConnection.EntitySchemaManager,"Activity");

activityQuery.AddAllSchemaColumns();

var activityId = new Guid("0afe839a-ff8c-4543-a7b8-29e4aab9787a");

var filter = activityQuery.CreateFilterWithParameters(FilterComparisonType.Equal, "Id", activityId);

activityQuery.Filters.Add(filter);

var activityEntities = activityQuery.GetEntityCollection(userConnection);

foreach (var activityEntity in activityEntities)

{

    var titleColumnCaption = activityEntity.Schema.Columns.GetByName("Title").Caption.Value;

}

return true;

Eugene Podkovka, This is only for c#? is posible in javascript?

In JS columns are already loaded. You can get access to the columns in the following way.

https://academy.bpmonline.com/documents/technic-sdk/7-11/use-entitysche…

Show all comments