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: 
Parikhharshal
Creator III
Creator III

Extract strings from log file

Hi experts

 

I have got log file like below from which I want to extract Applicant ID, Agent Applicant ID and Error:

 

OES Admission Application Process Log at 2020-02-18 09:12:34.733

***** START OF LOGS *****

Application Name:ERWGERG Application ID: A-5562 Cal Applicant ID: 431234 CRM Applicant ID: C-4357623
[INFO] - New Applicant ID 431234 created for Agent Applicant ID 0035Q000002hzDmQAL.
Preference 1 for application 123 has been successfully loaded into Applicant Portal.
No document has been inserted as no information has been provided.
Applicant Application data has been inserted, even though error(s) did occur. The data that caused the error has been ignored or the error has been ignored.

[ERROR] - Field <SCNDRY><COMPLETION_YR> that has been defined as mandatory by the institution has not been supplied.
Secondary data supplied has been matched to data that already exists for the applicant therefore the data has been ignored.
Tertiary data supplied has been matched to data that already exists for the applicant therefore the data has been ignored.
Either Planned Date or Date Achieved must be entered.

 

What's the best way to extract and if regex needs to be written, what it should be?

 

Thanks

Harshal.

Labels (2)
23 Replies
Parikhharshal
Creator III
Creator III
Author

@rhall

Could you please show exactly here how it should be?

Before you mentioned that I need to have two javaflex component. Is it ok if I use one javarow with while loop and when reading the data from arraylist then use for loop using javaflex component? Will it still work? Or do I need to change the design?

Also, if existing design is fine, how do I pass value of created arraylist to second java component?
Anonymous
Not applicable

You need to save your ArrayLists into the globalMap. To do this, you will need the end code section of the tJavaFlex. Your code to read the data into your ArrayLists can remain the same, just add it to the Main Code section of a tJavaFlex. You'll need to add the ArrayList instantiation to the Start Code. The flow of both components will look like this......

 

Read Data into ArrayLists

Start Code

ArrayList<String> array1 = new ArrayList<String>();
ArrayList<String> array2 = new ArrayList<String>();

Main Code

The same code you have but using the ArrayLists created in the Start Code

End Code

globalMap.put("array1", array1);
globalMap.put("array2", array2);

 

Then, when you read the data into your columns using another tJavaFlex you would do something like this....

Start Code

ArrayList<String> outputArray1 = ((ArrayList<String>)globalMap.get("array1"));
ArrayList<String> outputArray2 = ((ArrayList<String>)globalMap.get("array2"));

for(int i = 0; i<outputArray1.length.size();i++){

Main Code

You need to retrieve your values in this section and output them to columns created in the schema setup for the tJavaFlex

End Code

}

 

I can't really give you any more information than the above without doing it for you.  

Parikhharshal
Creator III
Creator III
Author

@rhall

I understood this but unable to do for this section.

You need to retrieve your values in this section and output them to columns created in the schema setup for the tJavaFlex.

What do you mean by this?

Could you please elaborate on this? How would I do this? How do I output to columns?
Anonymous
Not applicable

You need to set the output schema in the tJavaFlex you are using to get your ArrayList data into columns. You use the columns you create in the schema in the Main Code. This documentation shows how this is done....

https://help.talend.com/reader/NFGUc8bs6NnLij6GaHwLEg/Tf6KbwwwCnrhU2sWL4Dv6A