How read and update BDM using DAO in groovy script

Hi,
I’m using BonitaBPM 7.5 and I’ve created a process to update a table in my BDM from a MS-SQL connector. In a task I’ve added an ‘in connector’ and I have a process variable with the resultset of connector. I’m trying to access and update a bdm table but I don’t have a correct method. I’d appreciate an example to use. My idea is to add an operation with a script contaning a for-next with the resultset and in the loop, read a key of bdm table (a kind of find I suppose), do an update of the fields list and write the entity (set or put I suppose).

Thanks in advance.

Walter R.

Finally I’ve found my response trying this on groovy script:
'import com.company.model.mytable;

java.lang.String test = “Exit”; // simply to assign any result in left variable in operation;

for (int i=0; i < myProcessVariable.size(); i++) {
String myvary = myProcessVariable.get(i).get(0);
def myObj = demenageDAO.findByField2(myvary, 0, 1);
if ( myObj != null) {

				myObj.get(0).setField1("Test") ;
	  //.. others fields as needed. As simple as that...

}

}

return test ;’

This script is in my operation at right and at left there is a string variable to avoid errors compiling . It works!
I hope it helps others too. Let’s forget the update query in bdm.

Regards.

Hello,
to clarify my case, another thing I’ve tried is to do an update query (specific query) in bdm like:
“UPDATE mytable m set m.field1 = :field1 where m.field2 = :field2”.
And in operations I’ve written a script to test like:
"def varylist = reqtest;
varylist.get(0).getField1 =“MyTestxx”;
varylist.get(0).getField2 ="22 ";
varylist.get(0).getStartIndex = 0;
varylist.get(0).getMaxResult = 1;
return varylist; "
In operations at left I’ve put reqtest that it’s my query update obviuslly.
I know there’re errors but when I execute the process it runs with no errors. I missing something but I can’t see where. Other ideas or example to compare.
Thanks.