# Querying in an expression, using datatype string

**URL:** <https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249>\
**Category:** \[Q&A\] General\
**Created:** [June 13, 2024, 10:46am UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249 "2024-06-13T10:46:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [June 13, 2024, 10:46am UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/1 "2024-06-13T10:46:29Z")

</div>

Is there a way to do a query in an expression using a string of a datatype, for example : “systemversions~n\_systemchange#3c916451-d9fd-4bd4-8397-7de8e5fe0afc”.

Usecase: in the recordtype ExportDatasets, there is a plugin field called data\_type. This returns a string like the one above. I want to then query the table of that recordtype.

---

<div class="post-metadata">

**Author:** ![Wim](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@Wim](https://community.novulo.com/u/Wim)\
**Post date:** [June 13, 2024, 2:57pm UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/2 "2024-06-13T14:57:03Z")

</div>

I’m not 100% sure this is an answer to your question.

That string can be used in an expression in places where you would normally use just the type name. So you can query for

```auto
systemversions~n_systemchange#3c916451-d9fd-4bd4-8397-7de8e5fe0afc:load(1).system.id

```

or

```auto
{systemversions~n_systemchange#3c916451-d9fd-4bd4-8397-7de8e5fe0afc,system.id,id.islower(10)}

```

Does that help? Or did you mean something else?

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [June 13, 2024, 3:09pm UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/3 "2024-06-13T15:09:43Z")

</div>

Yes I know this is possible, but I want to use it in an expression in the architect (could’ve been more clear in that, sorry)

---

<div class="post-metadata">

**Author:** ![Wim](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@Wim](https://community.novulo.com/u/Wim)\
**Post date:** [June 13, 2024, 3:32pm UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/4 "2024-06-13T15:32:20Z")

</div>

Ah right, yes you can also do that, in processes. You can use the EvaluateExpression or (in some cases) ExpressionToolsEvaluateView actions from the Expression Tools plug-in for that as they accept expression strings.

You can build the expression string around the type name from the field with Concat blocks, for example

```auto
typename.concat(":count{").concat(typename).concat(",this}")

```

to get the number of records in such a type.

As a best practice, avoid using hard coded field and type names in such expressions, because the problem visitor and call tree will not be able detect that fields are being used there. (You can however use this, id, createdat, createdby, modifiedat, modifiedby, old(), load(…) and other default fields and functions.)

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [June 14, 2024, 6:21am UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/5 "2024-06-14T06:21:58Z")

</div>

Thx a lot Wim! I will try it and get back to you

---

<div class="post-metadata">

**Author:** ![Joeri](https://yyz2.discourse-cdn.com/flex008/user_avatar/community.novulo.com/joeri/32/428_2.png) [@Joeri](https://community.novulo.com/u/Joeri)\
**Post date:** [June 19, 2024, 6:30am UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/6 "2024-06-19T06:30:45Z")

</div>

@Wim the proposed solution works!

---

<div class="post-metadata">

**Author:** ![Jesse](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@Jesse](https://community.novulo.com/u/Jesse)\
**Post date:** [June 26, 2024, 3:00pm UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/7 "2024-06-26T15:00:28Z")

</div>

I don’t know if this is on topic and if it’s allowed to continue on solved questions. Anyways:  
I currently have and extra\_where from a process using expressionstools plugin, but how does this string expression work in the application?

F.e. I have need to filter my incoming class (organizations in this case) on multiple conditions but it expects a string:

 ![image](https://canada1.discourse-cdn.com/flex008/uploads/novulo/original/1X/f4a283848b22673b3142ab967382349deb260901.png)

---

<div class="post-metadata">

**Author:** ![m.gechev](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@m.gechev](https://community.novulo.com/u/m.gechev)\
**Post date:** [June 27, 2024, 6:49am UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/8 "2024-06-27T06:49:38Z")

</div>

Hi @Jesse ,  
What you have here is a String extensions plugin, validated expression field.  
This field seems to be configured to contain an expression that evaluates to a string. The expression i can see in your picture evaluates to a list of contact records.  
Here is a short explanation of the expression structure:  
{  
table\_to\_look\_up, (in your case, contacts)  
value\_to\_return, (in your case “this” means return record reference  
where\_condition (in your case you have 3 conditions, all of them which have to be true so you get a record)  
}  
then - the curly braces, means a list.

If your use case is the same as Joerie’s (you intend to put that expression into an EvaluateExpression action within a process, what you can do is to take the relevant part of the provided expression and wrap it in quotes. In this case, i assume you need the where part only, so you can modify the expression to:  
“boolean:and([this.is\_sales\_contact.equals(yesno:load(1)), etc etc])”  
the " " would make it behave as a literal string which you can further pass into the EvaluateExpression as Wim described above.

---

<div class="post-metadata">

**Author:** ![Jesse](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@Jesse](https://community.novulo.com/u/Jesse)\
**Post date:** [June 28, 2024, 6:49am UTC](https://community.novulo.com/t/querying-in-an-expression-using-datatype-string/249/10 "2024-06-28T06:49:44Z")

</div>

So it returned a string with “/n” in the string, which I removed now and hopefully this works. Thanks Miroslav :). ← This worked

Edit: Came back to give an update if this works.
