Variable in DB Connector

Hello I’m trying to pass a whole sql string into the connector.

For example i have the var SQLSTRING

then in the connector i only write ${SQLSTRING}

when i try to test the connector the following message appears

“Type of expression not admitted for test:
-Entry parameter ´script’ is using an expression that contains an unreachable reference”

why is this happening?

Thanks

The message sent to the diagram for the query
d1 photo d2_zps5pwjte84.png

Here is the connector that querys the DB
d2 photo d1_zpsoowpetrf.png

The way the connector calls the variable that contains the SQL string sent in the message
d1 photo d2_zps5pwjte84.png

When configuring the connector, on the “Enter query” configuration page, did you clicked on “Switch editor…” link and then select your variable in the drop down list?

i did that also and still shows me that message.

This is what i inserted in the script

return ${SQLSTRING};

How did you declare the SQLSTRING?

Also you should not open the Expression Editor but you be able to just select your variable in the drop down list.

The variable is a text process variable.

that process variable is populated data that comes in a message from another diagram

Can you share your diagram so I can take a look?

The “Switch Editor” workaround worked for me, this is a bit more complicated but works fine.
In deed, you have to create a Groovy script which will return your request :

return "INSERT INTO MVT_PERSONNEL (NOM_COLLABORATEUR, DATE_CHGT_PHYSIQUE, DATE_CHGT_SECTION) VALUES ('"+assignmentChangeBDM.getCollaboratorName()+"','"+assignmentChangeBDM.getDatePhysicalAssignment()+"','"+assignmentChangeBDM.getDateSectionAssignment()+"');";

I think this is linked to this bug : https://bonita.atlassian.net/projects/BBPMC/issues/BBPMC-279?filter=allopenissues

Did this version of the diagram run as expected or do you still have an issue?
If you still have problems can you share the process files (export as a single .bos file)?

Note that if asynchronous execution is not mandatory I would recommend to use call activities instead of messages.

Also if possible try to use Business Data Model feature that make business data storage a lot easier.