Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
BderPan
Contributor III
Contributor III

Add auto generate Data to postgreSQL

Hi

I have a problem with data of a tFileInputDelimited. 

my Job looks like: 
tFileInputDelimited -->tJava--> tJavaRow_1-->tMap-->tDBOutput_2

 

The CSV file I read had seperate cloumns like column1, column2 etc

I only need column1 and column2 , in column1 only a number like 12345 in column2 are numbers delimited by , --> 1234,5678 (the entry for that field is varaiable)
I write a script what split the column2, so I generate a incremtor for an ID in Database and set it to a primaryKey

//SplitingChild and connect to master for Table

String pzn = input_row.PZN;
String childPzns = input_row.CHILD_PZN;
String childPzn = "";
String childPZNout = "";

    	 //System.out.println("testout: " + test);
    	 if(childPzns != null && !childPzns.isEmpty()){
    	 
    	 String[] splittChildPZNs = childPzns.split("\\,");
    	 
    		 for (String childPZN : splittChildPZNs) {
    		 		i++;
            		System.out.println("PZN:  "+ pzn +" --> ChildPzn --> " + childPZN + " --> ID: " + i);
            		globalMap.put("pzn", pzn);
            		globalMap.put("childPzn", childPZN);
            		globalMap.put("id", i);
            		
            		 
            	 }
             
    	 } else {
    	 			i++;
            	 	System.out.println("PZN:  "+ pzn + " --> ID: " + i);
            	 	globalMap.put("pzn", pzn);
            		globalMap.put("childPzn", "");
            		globalMap.put("id", i);
            	 	
    	}

if I use the globalMap vars in tMap 
0683p000009Lzff.png

it only write the pzn, childpzn and id, for the number of line out of the tFileInput.
In my tLog it shows correct :


PZN: 01364773 --> ChildPzn --> 01364804 --> ID: 18224
PZN: 01364773 --> ChildPzn --> 01364796 --> ID: 18225

It only writes the last input with the ID 18225 and the input with the ID 18224 was ignored. 

Thanks for yout help 🙂 

best regards Chris



Labels (4)
1 Solution

Accepted Solutions
BderPan
Contributor III
Contributor III
Author

Thanks your for fast answer, 

and it is possible with a routine, tLibraryLoad, tJavaRow and java postgreSQL code connection. 

I connect to the Database via postgreSQL driver and loop some Data to the Database. So I solved the Problem and use a ETL Tool with JAVA 0683p000009MA9p.png

regards Chris 

View solution in original post

2 Replies
fdenis
Master
Master

your cannot use an etl as an java tool!
Talend data are in row not in globlaMap.
globalMap are to retrieve components data.
Context to set parameters to the job.

in you case you want to normaliz data so you can use tNormalize.

ones you have select tNormalize on Your Job Press F1 to have a sample.

Good luck.
BderPan
Contributor III
Contributor III
Author

Thanks your for fast answer, 

and it is possible with a routine, tLibraryLoad, tJavaRow and java postgreSQL code connection. 

I connect to the Database via postgreSQL driver and loop some Data to the Database. So I solved the Problem and use a ETL Tool with JAVA 0683p000009MA9p.png

regards Chris