how i run query in CDA with ktr? - pentaho

i want to create chart from ktr file by CDA in Pentaho bi server
<?xml version="1.0" encoding="UTF-8"?>
<CDADescriptor>
<DataSources>
<Connection id="weather" type="kettle.TransFromFile">
<KtrFile>farzanspoon.ktr</KtrFile>
<variables datarow-name="PHONE" variable-name="TEMP"/>
</Connection>
</DataSources>
<DataAccess access="public"
cache="true"
cacheDuration="3600"
connection="weather"
id="current"
type="kettle">
<Columns/>
<Parameters>
<Parameter default="9121901111"
name="PHONE"
type="String"/>
</Parameters>
<Query>current_conditions</Query>
<Output indexes="0,1"/>
</DataAccess>
</CDADescriptor>
in CDA i send phone number as TEMP(variable defined in ktr) but get this error
"Error Executing Query"
this is my ktr and db

Related

Parameters empty (or not supplied to CommandText) when using NLog with ASP.NET Core and SQLite

I've set up NLog in an ASP.NET Core MVC application using the examples in the documentation. Logging to a file (target=file) works without any problems.
However, logging to the Sqlite database results in an exception:
2018-10-30 20:04:41.4394 Error DatabaseTarget(Name=db): Error when
writing to database. Exception: System.InvalidOperationException: Must
add values for the following parameters: #MachineName, #Logged,
#Level, #Message, #Logger, #Callsite, #Exception at
Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior
behavior) at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at NLog.Targets.DatabaseTarget.WriteEventToDatabase(LogEventInfo
logEvent) at NLog.Targets.DatabaseTarget.Write(LogEventInfo
logEvent)
Any ideas why the values of these parameters are empty? Or maybe the parameters are not passed at all?
NLog configuration file:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="File" name="file" fileName="nlog-${shortdate}.log"
layout="${longdate}|${machinename}|${level:upperCase=true}|${logger}|${callsite}|${message} ${exception:tostring}" />
<target xsi:type="Database"
name="db"
dbProvider="Microsoft.Data.Sqlite.SqliteConnection, Microsoft.Data.Sqlite"
connectionString="Data Source=database.db;">
<commandText>
INSERT INTO Log (MachineName, Logged, Level, Message, Logger, CallSite, Exception)
VALUES (#MachineName, #Logged, #Level, #Message, #Logger, #Callsite, #Exception);
</commandText>
<parameter name="#MachineName" layout="${machinename}" />
<parameter name="#Logged" layout="${longdate}" />
<parameter name="#Level" layout="${level:upperCase=true}" />
<parameter name="#Message" layout="${message}" />
<parameter name="#Logger" layout="${logger}" />
<parameter name="#CallSite" layout="${callsite}" />
<parameter name="#Exception" layout="${exception:tostring}" />
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="file" />
<logger name="*" minlevel="Info" writeTo="db" />
</rules>
</nlog>
Unable to fix the issue using Microsoft.Data.Sqlite I switched to using System.Data.SQLite (NuGet) instead, which fixed the issue right away.
Remove the Microsoft.Data.Sqlite reference and add a reference System.Data.SQLite (1.0.109.2 at the time of writing) in your .csproj file. Update the dbProvider attribute value in nlog.config to System.Data.SQLite.SQLiteConnection, System.Data.SQLite and you're set.
nlog.config snippet:
<target xsi:type="Database"
name="db"
dbProvider="System.Data.SQLite.SQLiteConnection, System.Data.SQLite"
connectionString="Data Source=database.db;">
...
</target>

Izpack simple installation just to copy files

I am trying to make a very simplistic installer using IzPack. It should do the following two things
1. Copy and paste all the content of dist directory to UserHome/MyApp dir.
2. Execute a batch file to edit registry entry to start the jar file on user logon.
But I am stuck at the first step only! nothing is installed if I use the following XML and generate the installer. Generated installer runs and does show the InstallPanel but nothing is copied to the user_home directory.
From what it seems like I am not able to assign value to Install_path variable.
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
<variables>
<variable name="INSTALL_PATH" value="$USER_HOME/MyApp"/>
</variables>
<info>
<appname>My App</appname>
<appversion>1.0</appversion>
<authors>
<author name="My APP Author" email="support#myapp.com"/>
</authors>
<url>http://SomeURL.net</url>
</info>
<guiprefs width="640" height="480" resizable="yes"/>
<locale>
<langpack iso3="eng"/>
</locale>
<panels>
<panel classname="InstallPanel"/>
</panels>
<packs>
<pack name="Base" required="yes">
<description>The base files</description>
<fileset dir="dist" targetdir="$INSTALL_PATH"/>
</pack>
</packs>
</installation>
UPDATE
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
<variables>
<variable name="TargetPanel.dir.windows" value="$USER_HOME\MyTeamNinja"/>
<variable name="TargetPanel.dir.mac" value="$USER_HOME/MyTeamNinja"/>
</variables>
<info>
<appname>My App</appname>
<appversion>1.0</appversion>
<authors>
<author name="MyTeamNinja" email="support#MyTeamNinja.com"/>
</authors>
<url>http://myteam.ninja</url>
</info>
<guiprefs width="640" height="480" resizable="yes"/>
<locale>
<langpack iso3="eng"/>
</locale>
<panels>
<panel classname="DefaultTargetPanel"/>
<panel classname="InstallPanel"/>
<panel classname="SimpleFinishPanel"/>
</panels>
<packs>
<pack name="Base" required="yes">
<description>The base files</description>
<fileset dir="dist" targetdir="$INSTALL_PATH"/>
</pack>
</packs>
</installation>
Now as soon as I click the installer it starts the install but in c:\program files\My App\
what you need is a TargetPanel. it allows the user to select the destination dir. to install the files. the location selected in this panel sets the value of $INSTALL_PATH.
however, you may also override the default value of the $INSTALL_PATH.in order to override the default value of $INSTALL_PATH, you may do the following:
<variables>
<variable name="TargetPanel.dir.windows" value="$USER_HOME/MyApp"/>
<variable name="TargetPanel.dir.unix" value="$USER_HOME/MyApp"/>
</variables>
or,
<variables>
<variable name="DEFAULT_INSTALL_PATH" value="$USER_HOME/MyApp"/>
</variables>
and also, remember to include the TargetPanel before the InstallPanel in case you choose to allow the user to select the target loc. for the installation.
<panels>
<panel classname="TargetPanel"/>
<panel classname="InstallPanel"/>
</panels>
See HERE for more on this.
UPDATE:
place the entry for TargetPanel before the InstallPanel in the <panels> section.
remove the <resources> section:
<resources>
<res id="TargetPanel.dir.windows" src="$USER_HOME/MyApp"/>
<res id="TargetPanel.dir.unix" src="$USER_HOME/MyApp"/>
</resources> This is where the error is being generated. Instead use <variables> to specify default values for ${INSTALL_PATH} (see in my answer above).
also, to set a value for ${INSTALL_PATH} through <variables> you need to use name="DEFAULT_INSTALL_PATH" or TargetPanel.dir.windows/unix
UPDATE 2: The following piece of code installs in the correct location (as specified by you in the defaultInstallDir.txt).
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
<!-- variables>
<variable name="TargetPanel.dir.windows" value="$USER_HOME\MyTeamNinja"/>
<variable name="TargetPanel.dir.mac" value="$USER_HOME/MyTeamNinja"/>
</variables -->
<!-- remove the above <varible> section and include the REQUIRED defaultInstallDir.txt to set the value for the DefaultTargetPanel -->
<resources>
<res id="TargetPanel.dir" src="defaultInstallDir.txt"/>
</resources>
<info>
<appname>My App</appname>
<appversion>1.0</appversion>
<authors>
<author name="MyTeamNinja" email="support#MyTeamNinja.com"/>
</authors>
<url>http://myteam.ninja</url>
</info>
<guiprefs width="640" height="480" resizable="yes"/>
<locale>
<langpack iso3="eng"/>
</locale>
<panels>
<panel classname="DefaultTargetPanel"/>
<panel classname="InstallPanel"/>
<panel classname="SimpleFinishPanel"/>
</panels>
<packs>
<pack name="Base" required="yes">
<description>The base files</description>
<fileset dir="dist" targetdir="$INSTALL_PATH"/>
</pack>
</packs>
</installation>
now, create a file named defaultInstallDir.txt and simply write the following within this file :
$USER_HOME/MyApp
just make sure that you include this file correctly in the installer through the src=".." attribute of the <resources> section and you're good to go.
double clicking on the installer directly installs the files in $USER_HOME/MyApp (in my case: at C:\Users\Sunny\MyApp)

Unable to find the requested .Net Framework Data Provider. It may not be installed

I am using Nlog for Error loggin. I have configured the Nlog using the following code in web.config but the programs throws error "Unable to find the requested .Net Framework Data Provider. It may not be installed."
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true" internalLogFile="c:\nlog.txt" internalLogLevel="Debug">
<extensions>
<add assembly="NLog.Extended" />
</extensions>
<targets>
<target name="Console" xsi:type="Console" layout="${level:uppercase=true} ${message}"/>
<target name="DelivrosLogFile" xsi:type="File" fileName="C:\DelivrosLogs\Delivros.log" layout="${longdate} |${message}| ${stacktrace}"/>
<target xsi:type="Database" name="DelivrosDatabaseLogging" connectionStringName="DelivrosEntities"
commandText="INSERT INTO tbl_ErrorLogIn( Event_ID,Priority,Severity,Title,Timestamp,MachineName,AppDomainName,PocessID,ProcessName,ThreadName,Win32ThreadId,Message,FormattedMessage) VALUES (#Event_ID,#Priority,#Severity,#Title,#Timestamp,#MachineName,#AppDomainName,#PocessID,#ProcessName,#ThreadName,#Win32ThreadId,#Message,#FormattedMessage)">
<parameter name="#Event_ID" layout="0"/>
<parameter name="#Priority" layout="3"/>
<parameter name="#Severity" layout="${level}"/>
<parameter name="#Title" layout="Journal API"/>
<parameter name="#Timestamp" layout="${date}"/>
<parameter name="#MachineName" layout="${machinename}"/>
<parameter name="#AppDomainName" layout="Journal API"/>
<parameter name="#PocessID" layout="${processid}"/>
<parameter name="#ProcessName" layout="${processname}"/>
<parameter name="#ThreadName" layout="${threadname}"/>
<parameter name="#Win32ThreadId" layout="${threadid}"/>
<parameter name="#Message" layout="${exception}"/>
<parameter name="#FormattedMessage" layout="${message} "/>
</target>
</targets>
<rules>
<logger name="*" levels="Info,Warn,Error,Fatal" writeTo="Console"/>
<logger name="*" levels="Info,Warn,Fatal" writeTo="DelivrosLogFile"/>
<logger name="*" levels="Error" writeTo="DelivrosDatabaseLogging"/>
</rules>
I stuck with this for Four days...is there any one out there who can help me....
It was given providerName="System.Data.EntityClient" in connection string and i changed that to providerName="System.Data.SqlClient"
I can just add that if you already used EntityFramework you cannot simply change the provider in your connection string, as your Entity will not work. You can add another connection string for your error logging with providerName="System.Data.SqlClient".

VFS file processing in WSO2 Esb

I am executing a sample given for VFS file processing, but during execution getting the error as "Cannot find the object for smooks config key: smooks".
Could you please let me know what I have missed out?
Configurations made are as below.
Local entry for smooke is created with below configuration in smooke-key.xml
<localEntry key="smooke" src="file:/development/Dev/wso2esb-4.8.0/repository/resources/smooks-config.xml"><description/></localEntry>
==================================================================================
Smooke-config.xml is as below
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
<!--Configure the CSVParser to parse the message into a stream of SAX events. -->
<resource-config selector="org.xml.sax.driver">
<resource>org.milyn.csv.CSVParser</resource>
<param name="fields" type="string-list">name,value</param>
</resource-config>
Proxy service is as below
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="FileProcessor"
transports="vfs"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log level="full"/>
<smooks config-key="smooke">
<input type="text"/>
<output type="xml"/>
</smooks>
<clone>
<target sequence="fileWriteSequence"/>
<target sequence="databaseSequence"/>
</clone>
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///development/Dev/fileProcessing/sourcefiles</parameter>
<parameter name="transport.vfs.FileURI">file:///development/Dev/fileProcessing/in</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///development/Dev/fileProcessing/error</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>
create the smooks configuration at
wso2esb-4.8.0/repository/samples/resources/smooks/Smooke-config.xml
and restart the esb
change the localentry file like this
<localEntry key="smooke" src="file:repository/resources/smooks-config.xml"><description/></localEntry>

Is it possible to invoke a antscript in postdst and presrc call in MQFTE?

Is it possible to invoke a antscript in postdst and presrc call in MQFTE??
Here's an example:
<request version="4.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FileTransfer.xsd">
<managedTransfer>
<originator>
<hostName>$hostName</hostName>
<userID>$userID</userID>
</originator>
<sourceAgent QMgr="$sourceQM" agent="$sourceAgent"/>
<destinationAgent QMgr="$destQM" agent="$destAgent"/>
<transferSet priority="5">
<metaDataSet>
<metaData key="some_key">Some value</metaData>
</metaDataSet>
<postSourceCall>
<command name="example.xml" retryCount="0" retryWait="0" successRC="0" type="antscript">
<property name="ant.FILEPATH" value="$filepath"/>
<property name="antSrcAgent" value="$sourceAgent"/>
</command>
</postSourceCall>
<item checksumMethod="MD5" mode="binary">
<source disposition="delete" recursive="false">
<file>$filepath</file>
</source>
<destination exist="error" type="directory">
<file>$destFile</file>
</destination>
</item>
</transferSet>
<job>
<name>Example FTE job</name>
</job>
</managedTransfer>
</request>
The properties passed to the ant script are arbitrary names. You could pass any properties in that way. I used postSourceCall but you can change that to postDest, preSource, etc.