PDA

View Full Version : Simple SQLExecute from Secure Filter



jasonsheldon
05-21-2008, 04:05 AM
Hi

I am new to pentaho and have been struggling to create a simple form that inserts a username into the database. I have attached my xaction. Basically the form works well and when I submit it simply returns to the form and does no database insert. I only see a warn message [Parameters] Parameters: Invalid chunk ignored.


Any help would be apprecaited

jasonsheldon
05-21-2008, 10:04 AM
I decided to simply try and do SQLExecute with hardcoded values and this insert works (same insert from above) so it seems to be either a problem with using my parameters from the Secure Filter or with how I am using paramaters. I use them like insert into .... values('{username}' and so forth

pmalves
05-21-2008, 10:17 AM
I've done that several times and it worked, my xactions are very similar to yours

jasonsheldon
05-22-2008, 04:05 AM
Hi

I solved this problem and now have moved on with a new problem:-

Once I run the insert I want to display a friendly message for a successful insert or for a failure.

I use the <condition> but it seems as if the SQLExecute failure means it does not move on to the next action?

i.e. in the browser I see the error message from the failed execute
Error: SQLBaseComponent.ERROR_0006 - Could not execute adduser.xaction : Duplicate entry 'jason' for key 1 (org.pentaho.plugin.sql.SQLExecute)

When I set continue_on_exception to true it moves on but then I am not sure what condition test to perform as using the following:-


<actions>
<condition><![CDATA[query_result.getRowCount() >0]]></condition>
<action-definition>
<component-name>TemplateComponent</component-name>
<action-type>Message Template</action-type>
<action-inputs>
<username type="string"/>

</action-inputs>
<action-outputs>
<output-message type="string" mapping="statusmsg"/>
</action-outputs>
<component-definition>
<template><![CDATA[{username} was created successfully]]></template>
</component-definition>
</action-definition>

</actions>

<actions>
<condition><![CDATA[query_result.getRowCount() == 0]]></condition>
<action-definition>
<component-name>TemplateComponent</component-name>
<action-type>Message Template</action-type>
<action-inputs>
<username type="string"/>
</action-inputs>
<action-outputs>
<output-message type="string" mapping="statusmsg"/>
</action-outputs>
<component-definition>
<template><![CDATA[Failed to create {username}.]]></template>
</component-definition>
</action-definition>

</actions>

it always says successful regardless. I tried using
<condition><![CDATA[query_result]]></condition>
and <condition><![CDATA[!query_result]]></condition>

with same result