Answered

Use of LIKE in SQL sentences

Hello! I created this topic yesterday but I don't see that it is active. Why?

Comments (11)

photo
1

My full question was in another topic, but for some reason it was deleted.

How can I include LIKE operator when building SQL sentence. I tried following and it didn't work:

Filterstring = "Trademark LIKE %TrademarkFilter%";

Filterstring = "Trademark LIKE %" + "TrademarkFilter" + "%";

photo
2

Dear Natalia,

Regarding the created post, you mentioned to delete. Regarding the "Like" in SQL Sentences, please check this article: http://help.bizagi.com/bpmsuite/en/index.html?filter_with_expressions.htm

Regards

photo
1

Hello Juan,

Is there any update on this topic?

photo
photo
1

Hello Juan,

Thank you for your answer. I looked at that article before, but there is no example with LIKE and the sentences which I guessed didn't work, so can you please provide me the example of the proper use of it?

photo
2

Dear Natalia,

Regarding your question, there is no a way to execute SQL sentences directly. You can use one of our function and apply the filter as you need. The following is the syntax of the EntityManager function:

CEntityManager.GetEntity("Entity").GetEntityList("Attribute","Filter","Search","Order");

For further information: http://help.bizagi.com/bpmsuite/en/index.html?access_entities_not_related_to.htm

Best Regards

photo
1

Hello Juan,

Thank you for your answer. In that article there is no mention of LIKE as well, so I assume this is not supported by Bizagi, correct?

photo
2

Dear Natalia,

"Like" is used as a filter a query result. In this way, you can try to create a filter using %something% and obtain the result using the previos function. The example of a filter is like: "Client =" +<Request.Client>

Regards

photo
1

Hello Juan,

I didn't understand where I can use %something%:

1) in CEntityManager.GetEntity("Entity").GetEntityList("Attribute","Filter","Search","Order");

OR

2) in Filter = "Client =" +<Request.Client>

And how exactly?

photo
1

Dear Natalia,


For example:

  1. Var Filter= "ClientName like %"+<Request.Name>+"%";
  2. //Get the identifier of the record
  3. var Entity = CEntityManager.GetEntity("Client").GetEntityList("id",Filter,"","");
  4. for(var Counter=0; Counter< Entity.Length;Counter++)
  5. {
  6. //Get the attribute value of the record
  7. var Surrogate= Entity[Counter].SurrogateKeyValue;
  8. var Value= Entity[Counter].Attributes["id"].Value;
  9. }



You can play with the filer.
Regards

photo
2

here is how the equation should look like:

Filterstring = "Trademark LIKE '%" + <Upload_TM.TrademarkFilter> +"%'"

In case somebody will need it in future

photo
2

FYI: In version 11, when using the 'get list' function, the filter is like this:

var Filter = "ClientName LIKE " + "\"%" + <Request.Name> + "%\"" ;

var Clients = Me.getXPath("entity-list('Client','"+Filter+"')");

For other people that are struggeling with this as well :)

photo