I have posted this question in the Logi Analytics DevNet but it is a graveyard there and I am hoping I can get an answer here. I am using Logi Info v12.2.116.
I am using a stored procedure to get data to fill my reports. The stored procedure calls an RPG program. I have done this many times, but today when I created a new stored procedure, a new report, the parameters for some reason do not match up. I have restarted Logi as well... Sometimes it doesn't pick up new stored procedures until it reboots but that didn't work either. I have never seen this error before:
The number of parameter values set or registered does not match the number of parameters
Here is the code for my parameters:
<DataLayer Type="SP" Command="myStoredProcedure">
<SPParameters NullValue="'">
<SPParameter SPParamDirection="Input" ID="GAct" SPParamSize="2" SPParamType="dt-129" Value="RE" />
<SPParameter SPParamDirection="Input" ID="rsDetail" SPParamType="dt-129" Value="N" SPParamSize="1" />
<SPParameter SPParamDirection="Input" ID="rsFromDate" SPParamSize="10" SPParamType="dt-7" Value="# Request.paramFromDate~" />
<SPParameter SPParamDirection="Input" ID="rsToDate" SPParamSize="10" SPParamType="dt-7" Value="# Request.paramToDate~" />
<SPParameter SPParamDirection="Input" ID="rsDepts" SPParamSize="256" SPParamType="dt-129" Value="# Request.paramAllDepartments~" />
</SPParameters>
Here is the stored procedure definition:
1 IN GACT CHARACTER 2 No default
2 IN RSDETAIL CHARACTER 1 No default
3 IN RSFROMDATE DATE No default
4 IN RSTODATE DATE No default
5 IN RSDEPTS CHARACTER 256 No default
What in the world is causing this problem? Yes I am connecting to the same partition/library. Yes the program and stored procedure work perfectly fine when being called outside of Logi. Yes I am calling the right stored procedure.
Change:
<SPParameter SPParamDirection="Input" ID="GAct" SPParamSize="2" SPParamType="dt-129" Value="RE" />
To:
<SPParameter SPParamDirection="Input" ID="GAct" SPParamSize="2" SPParamType="dt-200" Value="RE" />
Char is generally considered to be a single character and is likely what is causing your issue. Also, unrelated, but I typically just use size 0 on all my SPParams to avoid truncation issues.
Related
I have a custom Instrument with a os-signpost-interval-schema that captures a "state" string. I would like the final plot value to be <state>: <duration>, but I don't know how to get the duration into the string.
My working schema is the following, which just stores the state itself in the column:
<os-signpost-interval-schema>
<id>state-interval</id>
<title>State Interval</title>
<subsystem>"..."</subsystem>
<category>"..."</category>
<name>"state"</name>
<start-pattern>
<message>?state</message>
</start-pattern>
<column>
<mnemonic>state</mnemonic>
<title>State</title>
<type>string</type>
<expression>?state</expression>
</column>
</os-signpost-interval-schema>
I would like to change the expression in the column to (str-cat ?state ": " ?duration), but that fails with:
Variable '?duration' must appear in a pattern element to be used in a later expression.
I don't see any way to compute this later in the graph, lane, or plot. I've also tried explicitly creating a <duration-column>, but that doesn't seem to change anything.
The rest of the pieces include the table:
<create-table>
<id>state-table</id>
<schema-ref>state-interval</schema-ref>
</create-table>
And the lane, which I would like to display as <state>: <duration> rather than just the duration:
<lane>
<title>State</title>
<table-ref>state-table</table-ref>
<plot>
<value-from>state</value-from>
</plot>
</lane>
This turns out to be impossible. Apple does not expose duration as a variable. It can be solved by writing a custom modeler, though this adds a lot of complexity.
I am coping with the localization of the Date/Time placeholders in form-runner of Orbeon 2018 (albeit it seems this has not been changed in 2019 and 2020 neither).
What I am looking for is defined in orbeon-form-runner.jar\xbl\orbeon\date\date.xbl (and time/time.xbl, but for now, I think it is enough to discuss the first one) file, more specifically here:
<xf:var
name="placeholder"
value="
let $format := xxf:property('oxf.xforms.format.input.date'),
$cleaned := translate($format, '[01]', ''),
$duplicate := replace(replace(replace($cleaned,
'M', 'MM'),
'D', 'DD'),
'Y', 'YYYY'),
$format-en := instance('orbeon-resources')/resource[#xml:lang = 'en']/format,
$format-lang := xxf:r('format'),
$translated := translate($duplicate, $format-en, $format-lang)
return
$translated
"/>
<xh:input type="text" placeholder="{$placeholder}" id="input"/>
The placeholder variable is assembled over the html input, this is clear.
In my language, the YYYY, MM, DD is not the right placeholder for date parts, so my requirement is to change them depending on the current request locale.
At first I tried to extend the labels in the apps/fr/18n/resource.xml, and I replaced the static 'MM', 'DD', etc. constants with xxf:r('components.labels.MM', '|fr-fr-resources|')) and similar things without any success (okay, the placeholder has been displayed, but the same default placeholder that was visible before my modification).
My second approach was to put these labels to the same file, and refer them on the same way: xxf:r('MM'), no success (the same result as in the first case).
My third approach, and I am here now, was to trying to hardcode these static things and only fix these labels for my locale (using an xsl:choose) and here I am: I can't find how on earth could I grab the request locale here (in the context of xbl files).
Neither the <xf:var name="lang" value="xxf.instance('fr-language-instance')"/>, nor the <xf:var name="fr-lang" value="xxf.instance('fr-fr-language-instance')"/> variables pointed to the right current request locale (they showed as "en").
Do you have any idea how to solve this properly?
You define the input format through the oxf.xforms.format.input.date property. And there can be only one input format, which can't depend on the current language.
In the placeholder, the component shows the format you defined through in oxf.xforms.format.input.date, but changing the letter M (month), D (day), and Y (year) to match the current language, and that is done by adding a resource to orbeon-resources, which has currently:
<resource xml:lang="en"><format>MDY</format></resource>
<resource xml:lang="fr"><format>MJA</format></resource>
<resource xml:lang="de"><format>MTJ</format></resource>
<resource xml:lang="pl"><format>YMD</format></resource>
I have stored procedure that I need to call using MyBatis. Anyway I managed to call this stored procedure. Procedure has multiple out parameters. One of out parameter is oracle cursor. I need to iterate over Oracle Cursor, but when I do this without any fine-tuning of jdbc driver using fetchSize attribute, it goes row by row and this solution is very slow.
I am able to set on procedure call fethcSize attribute:
<select id="getEvents" statementType="CALLABLE" parameterMap="eventInputMap" fetchSize="1000">
{call myProc(?, ?, ?, ?, ?)}
</select>
But this doesn't helps at all. I think that this doesn't work because of multiple out parameters - so program doesn't know where this fetch size should be applied - on which out parameter. Is there any way to set fetch size on ResultSet(Oracle cursor)? Like when I use CallableStatemen from java.sql package I am able to set on ResultSet fetch size.
Here are mapping files and procedure call from program:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="mypackage.EventDao">
<resultMap id="eventResult" type="Event">
<result property="id" column="event_id" />
<result property="name" column="event_name" />
</resultMap>
<parameterMap id="eventInputMap" type="map" >
<parameter property="pnNetworkId" jdbcType="NUMERIC" javaType="java.lang.Integer" mode="IN"/>
<parameter property="pvUserIdentityId" jdbcType="VARCHAR" javaType="java.lang.String" mode="IN"/>
<parameter property="result" resultMap="eventResult" jdbcType="CURSOR" javaType="java.sql.ResultSet" mode="OUT" />
<parameter property="success" jdbcType="INTEGER" javaType="java.lang.Integer" mode="OUT"/>
<parameter property="message" jdbcType="VARCHAR" javaType="java.lang.String" mode="OUT"/>
</parameterMap>
<select id="getEvents" statementType="CALLABLE" parameterMap="eventInputMap" fetchSize="1000">
{call myProc(?, ?, ?, ?, ?)}
</select>
</mapper>
And call from program:
SqlSession session = sqlSessionFactory.openSession();
Map<String, Object> eventInputMap = new HashMap<String, Object>();
try {
EventDao ed = session.getMapper(EventDao.class);
eventInputMap.put("pnNetworkId", networkId);
eventInputMap.put("pvUserIdentityId", identityId);
eventInputMap.put("success", 0);
eventInputMap.put("message", null);
ed.getEvents(eventInputMap);
session.selectList("EventDao.getEvents", eventInputMap);
} catch (Exception e) {
e.printStackTrace();
}finally{
session.close();
}
Thanks in advance!
The provided code works. I have even checked 3 ways to write it: like here with parameterMap, without parameterMap (mapping directly in the statement), and through annotations, everything works.
I used to thing the fetchSize setting was not propagated from main statement to OUT param resultSet, until I really tested that, lately.
To apprehend whether the fetch size is used or not and how much effect it has, the result must contain a large enough number of rows. And of course, the poorest is the latency from app to DB, the more noticeable is the effect.
For my test, the cursor used by procedure returned 5400 rows of 120 columns (but the most important is the row count).
To give an order of magnitude, I have measured fetching times, i.e from the stored procedure return to the statement return, with a result list filled with data fetched from cursor. Then I log the instanciation of the first object mapped, this occurs near the beginning of the global fetching, probably after the first fetch:
public static boolean firstInstance = true;
public Item() {
if (firstInstance) {
LOGGER.debug("Item first instance");
firstInstance=false;
}
}
And I log again just at the end, after the session.selectList returns.
This is for test purpose only. Do not let that is your code. Find a clean way to do it.
Here are some timing depending on the configured fetch size:
- fetchSize=1 => 13000 ms
- fetchSize=10 => 5300 ms
- fetchSize=100 => 3800 ms
- fetchSize=300 => 3700 ms
- fetchSize=500 => 3650 ms
- fetchSize=1000 => 3600 ms
Oracle JDBC driver default fetchSize is 10.
Testing with fetchSize=1 allows proving the supplied setting is used.
With 100, here, 30% are saved. Beyond, the gain is negligible (with this use case, and environment)
Anyway, it would be interesting to be able to know when procedure execution finishes and when result fetch starts.
Unfortunately, Mybatis logs very few. I thought custom result handler could help, but looking at the source code of class org.apache.ibatis.executor.resultset.DefaultResultSetHandler, I notice that
unlike method handleResultSet (used for simple select statements) that allows using a custom result handler, method handleRefCursorOutputParameter (used here for procedure OUT cursor) does not. Then no need to trying passing a custom result handler: it will be ignored.
I am interested in a solution if anyone has one. But it seems an evolution request will be required.
I have to change the header string of primefaces dialog, acording to a variable state in my backing bean. The condition would be the following (pseudo code):
#{backingBean.editing ? resourceBundle.edit_string resourceBundle.item.id : msg.add_string}
and the short snippet example:
<p:dialog id="dokDialog" header="#{backingBean.editing ? resourceBundle.edit_string resourceBundle.item.id : msg.add_string}" ...>
<!-- content -->
</p:dialog>
In this example I want to display either value #{msg.edit_string} #{resourceBundle.item.id} or #{msg.add_string} according to boolean value of #{backingBean.editing}.
What I want to do is to show either Editing Item 01 or New Item in the title.
Also I get the following exeption because I have two expressions (resourceBundle.edit_string resourceBundle.item.id) for one result:
Caused by: org.apache.el.parser.ParseException: Encountered " <IDENTIFIER>
Thanks!
resourceBundle.edit_string resourceBundle.item.id - it's a wrong expression. You need to concatenate
String.concat may help if you are using an appropriate version of EL: resourceBundle.edit_string.concat(' ').concat(resourceBundle.item.id)
I have a Jasper report which accepts an Integer parameter.
I am using the <g:jasperReport> tag to call the report. The body of this tag has an HTML <input> whose value gets passed to the report.
The report is not working. It is giving an InvalidFormatException.
Please help.
Thanks in advance.
Abe
I found that defining the passed-in parameter as a String works even in the SQL; i.e., in the .jrxml:
<parameter name="headerid" class="java.lang.String">
<parameterDescription><![CDATA[ID this report is for]]></parameterDescription>
<defaultValueExpression><![CDATA['1']]></defaultValueExpression>
</parameter>
Use it in the SQL as you would an Integer; i.e.:
where header.id = $P{headerid}