How to get jsonpathquery or Xpathquery for columns in talend? - talend

tFileInputJson--> component --> Basic settings--> Mapping
How can we get jsonpathquery or Xpathquery for columns in talend:

you will have to declare a JSON metadata for input file (Repository>Metadata>Json File). There, based on an existing jsonfile, you'll be able to get json query for all the fields.
See talend help : https://help.talend.com/display/TalendOpenStudioforDataIntegrationUserGuide62EN/7.11.1+Setting+up+JSON+metadata+for+an+input+file

Related

Conversion from XML to Json removes 0 in Azure Data Factory copy activity

I am converting XML files to Json(gzip compression) using Azure Data Factory copy activity.
However , I observe that in the XML file I have the values stored as 0123456789. However , when this is converted to Json it is saved as "value" : 123456789. Without 0.
I would like to keep the Json values as-is from the XML . Please provide suggestions for the same.
PS: I can't use data flow and I can't modifiy the xml file.
The solution was to uncheck the detect data type in the copy activity

Extracting data from XML file to SQL Server in form of table

I'm new to talend and have been trying to transfer the xml data (attached file) to SQL Server.
After using the tFileinputXml, tmap_xml and tDBoutput component only one row of the file was transferred.
Please guide me to populate multiple rows iteratively else guide me on converting the xml file to excel file.
Thanks in advance Smiley Happy
The tags in the files are columns while the string between tags is the data to be transferred as rows.

Talend component that takes multiple rows as input and returns one row as output?

I have an XML file (tFileInputXML) as the start point of my job, from that XML, i'd like to "combine" all its rows in a java List/Array/Whatever and get that List as output.
Is there a component in Talend that offers such mechanism ?
NB : I've already tried the TJavaFlex component but it still output many rows.
Thank you in advance.
You need to read the file, map its fields using tXMLMap and then process them in a java component :

Generate a CSV file with combination of unique field and XML using spark dataframe

I am reading an XML into a spark Dataframe using com.databricks.spark.xml and trying to generate a csv file as output.
My Input is like below
<id>1234</id>
<dtl>
<name>harish</name>
<age>21</age>
<class>II</class>
</dtl>
My output should be a csv file with the combination of id and remaining whole XML tag like
id, xml
1234,<dtl><name>harish</name><age>21</age><class>II</class></dtl>
Is there a way to achieve the output in the above format.
your help is very much appreciated.
Create a plain RDD to load xml as text file using sc.textFile() without parsing.
Extract id manually with the help of regex/xpath and also try to slice RDD string using string slicing from start of your tag to end of your tag.
Once it's done you will have your data into map like (id,"xml").
I hope this tactical solution will help you...

Extracting Data from HL7 Files in Talend

I am trying to read data from HL7 files using Talend.
The component that I am using is tHl7Input component.
Job :
The sample file that I am using is below:
MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3|
PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000|
Hl7 Component Configuration:
But I am not able to extract the data from it.
Output which I am getting with null values:
I have read the forum of Talend to read the Hl7 files, but i not not able to extract the same.
https://help.talend.com/display/TalendComponentsReferenceGuide61EN/tHL7Input
Any inputs on this would be helpfull.
I have never use Talend. This is based on the screenshots you have given.
Your mappings are off by +1.
MSH.1 should hardcode to | (pipe).
MSH.2 should map to newColumn4.
MSH.3 should map to Name1, and output shall be Cerner.
MSH.4 should map to Name3, and output will be null as there is nothing in the message.
So on and so forth.
You need to change your data map to use accurate hl7 component names - Encoding characters, Sending Application etc. Otherwise, at the end of assignment you will end up confused.