How to define an output connector ?

1
0
-1

Hello
In my step I join an output connector : i want to store my form's values in a table microsoft sql server.
I write this line but it doesn't work :

INSERT INTO dbo.mytable VALUES('${var}')

then i write this line and it doesnt work too !

INSERT INTO dbo.mytable VALUES(5)

Can somebody help me please ?

Comments

Submitted by pierrick.voulet on Thu, 06/28/2018 - 20:40

You can find a lot of information about database connector usage from this official documentation page .

In can it does not help, please give more insight of what you are trying to achieve:
- When you say output connector, you mean connector out right?
- Which type of connector do you use?
- Where did you right these lines?
- Do you have any error in the Logs (Menu Help/Engine Logs)?

Cheers,

Submitted by arnaud.norel-ex... on Fri, 06/29/2018 - 10:09
  • yes
  • Microsoft SQL
  • i write these lines here : (I select my step) Execution / Connector Out / Add / Request
    And just before I wrote the Id and password to access to my table
    And I selected sqljdbc4.jar
Submitted by arnaud.norel-ex... on Fri, 06/29/2018 - 10:58

and when I try to put this line (insert values(5) ) in test connector, it is ok.

Submitted by arnaud.norel-ex... on Fri, 06/29/2018 - 11:10

ok finally connector out works !
But only when i try to insert constants ( INSERT INTO .... VALUES(5) )
What is the right syntax to INSERT my variable ?

Submitted by pierrick.voulet on Fri, 06/29/2018 - 15:28

When I need to use variables, I usually click on "Switch editor..." and edit the "Query or Batch Script" expression as a "Script" (Groovy Script). This gives you a dropdown with all accessible variables that you can use.

I add a screenshot here for your reference.

Submitted by arnaud.norel-ex... on Fri, 06/29/2018 - 15:56

Thank you

Now I have a new issue : I define an INT (nombreJours) in my business data (demande) and my request is

INSERT INTO dbo.mytable (columnb)
VALUES(${data:demande.nombreJours})

I have an error :
"Declared return type class java.lang.String is not compatible with evaluated type class java.lang.Integer for expression data:demande.nombreJours"

But I never define "demande" as a STRING ! I always define it as an INT
May be can we only return string with bonita ? or is possible to return INT ?

Submitted by pierrick.voulet on Fri, 06/29/2018 - 16:04

What about using a regular Java instruction in your Groovy Script expression like:

return "INSERT..." + demande.nombreJours + "...";

I never use "$" or "data:" on my side so not sure why it would end up with error.

Submitted by arnaud.norel-ex... on Fri, 06/29/2018 - 16:25

Thank you very much !

No answers yet.
Notifications