It sounds so bleepin' simple but...

Following my previous quesionts… and thanks for the help so far. All I want to do right now is get a specific row from my postgres database into a variable so that I can work with it.

I’m not well-versed in java/groovy, and I don’t have enough experience with Bonita YET.

I’ve tried scripts and queries, I’ve tuned and modified, but it comes down to I need a script, and in my case since the row may or may not exist in postgres, I have created a dummy row that signals that the customer does not exist:

import groovy.sql.Sql;

import java.sql.Driver;

def list=;

Sql sql=BonitaSql.newInstance(“jdbc:postgresql://172.17.0.2:5432/HFDataProd”,“bonita_db_user”,“bpm”, new org.postgresql.Driver())

sql.eachRow(“SELECT * FROM customer WHERE customer = '” + enteredname +“';”) {
list += it.customerid.toInteger();
list += it.customer.toString();
list += it.password_open.toString();
list += it.password_encrypted.toString();
list += it.buyfor1.toString() == “null” ? (“0”).toInteger() : it.buyfor1.toInteger();
list += it.buyfor2.toString() == “null” ? (“0”).toInteger() : it.buyfor2.toInteger();
list += it.buyfor3.toString() == “null” ? (“0”).toInteger() : it.buyfor3.toInteger();
list += it.buyfor4.toString() == “null” ? (“0”).toInteger() : it.buyfor4.toInteger();
list += it.buyfor5.toString() == “null” ? (“0”).toInteger() : it.buyfor5.toInteger();
list += it.lastchanged_date.toString();
list += it.created_date.toString();
}

if (list.size()==0) {
list += (“0”).toInteger()
list += “none”
list += “none”
list += “none”
list += (“0”).toInteger()
list += (“0”).toInteger()
list += (“0”).toInteger()
list += (“0”).toInteger()
list += (“0”).toInteger()
list += “none”
list += “none”
}

return list;

Now that being said, I can read the database, but I can’t change the result type so I can’t assign it.

Doesn’t do me much good yet.

Thanks.

Logfile:

016-05-02 09:43:19.300 -0400 org.bonitasoft.engine.api.impl.transaction.flownode.ExecuteFlowNode org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
INFO: THREAD_ID=65 | HOSTNAME=BRL15vW01 | TENANT_ID=1 | The user has executed the task [name = , display name = , id = <180005>, parent process instance = <10002>, root process instance = <10002>, process definition = <5502850554537348713>] with task inputs: {pool_WebAccess_bdocustomerInput={custpass=kjdfldfj, custname=denise denise}}
2016-05-02 09:43:20.168 -0400 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log
SEVERE: THREAD_ID=103 | HOSTNAME=BRL15vW01 | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : “PROCESS_DEFINITION_ID=5502850554537348713 | PROCESS_NAME=WebAccess | PROCESS_VERSION=1.0.05 | PROCESS_INSTANCE_ID=10002 | ROOT_PROCESS_INSTANCE_ID=10002 | FLOW_NODE_DEFINITION_ID=6549442944915597989 | FLOW_NODE_INSTANCE_ID=180006 | FLOW_NODE_NAME=Step1 | CONNECTOR_IMPLEMENTATION_CLASS_NAME=con_getPGcustomerrow | CONNECTOR_INSTANCE_ID=160002 | Declared return type class java.lang.String is not compatible with evaluated type class java.util.ArrayList for expression scr_getPGcustomerrow”
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=5502850554537348713 | PROCESS_NAME=WebAccess | PROCESS_VERSION=1.0.05 | PROCESS_INSTANCE_ID=10002 | ROOT_PROCESS_INSTANCE_ID=10002 | FLOW_NODE_DEFINITION_ID=6549442944915597989 | FLOW_NODE_INSTANCE_ID=180006 | FLOW_NODE_NAME=Step1 | CONNECTOR_IMPLEMENTATION_CLASS_NAME=con_getPGcustomerrow | CONNECTOR_INSTANCE_ID=160002 | Declared return type class java.lang.String is not compatible with evaluated type class java.util.ArrayList for expression scr_getPGcustomerrow

And since I can’t change the return type from java.lang.Sring, I don’t seem to be able to get past here.

Reflecting… if I could do it in an SQL statement, this problem would go away. So far, I’ve not seen a working WHERE clause, or at least I’ve not been able to mimic a working scenario.

I really, really wish that there were ‘real-world’ application examples - fooling around with a vacation management example is great, and it teaches a lot, but real-world applications use database, and external connection, and all sorts of good things.

Thanks for listening to my rant.

I am an outsider like you, but this group is pretty solid. When I am ready to buy, it will be bonitasoft.

I am an outsider like you, but this group is pretty solid. When I am ready to buy, it will be bonitasoft. When you figure it out, give back, you will feel good :wink: link

I guess I’m having a problem communication…

If I run the connector with the script “select * from customer where customerid =2;” I get the result I’d like - the connector allows me to assign it to an nxn result.

That’s what I want. Then I can use it.

Except, I don’t always want to get customerid 2! I’d like to be able to use a variable or something!!! How do I write that???

Thanks!

Apologies for the sparky.

Apologies for the snarky.