Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is it possible to get the value of the variable from tJavaRow?

Hi there,
I have a job that is as follows:
0683p000009MD1U.jpg
It takes the value from specific cells from all the sheets in the workbook from the tFileExcelInput. It takes values from multiple cells and assigns them to a context variable. Each sheet is a row is the way to think of it.
I'm just stuck on how to output all the rows i.e. context variable values returned to either a tLogRow or OutputDelimited file?
Thanks,
Facoda

 
Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hi 
After you read the file and assign values to the context variables, you can use tFixedFlowInput to generate an input flow and output them to a file. For example:
tFileInputExcel-main--tJavaRow
   |
onsubjobok
   |
tFixedFlowInput--main-tFileOutputDelimited
on tFixedFlowInput, define the columns which data you want to output and set the value of each column with corresponding context variable. 
BR
Shong
Anonymous
Not applicable
Author

Hi Shong,
I've already tried this job design but it only seems to return the values on the first sheet. It does not return the values from all the sheets.
Thanks
Anonymous
Not applicable
Author

If you read all sheets, it should returns data of the last sheet with this job design. If you expect to output data for each sheet, you need to iterate each sheet, refer to this custom component shared by jlolling, or write down all the sheet name in a file and iterate each sheet name one by one. For example:
tFileInputDelimited--main(row1)--tFlowToIterate--Iterate-tFileInputExcel-main--tJavaRow-oncomponentok-tFixedFlowInput--main-tFileOutputDelimited
on tFileInputExcel, uncheck 'all sheet' box, and type in the sheet name in the Sheet list as below:
(String)globalMap.get("row1.sheetName")

//sheetName is the column name on tFileInputDelimited

Best regards
Shong
Anonymous
Not applicable
Author

Hi Shong,
I'm not sure I totally understand this flow that you have. 
1. (String)globalMap.get("row1.sheetName") is a global variable but the tFileInputDelimited does not have such a variable output that it can pass onto another component? I'm not sure how you can get the sheet name from the tFileInputDelimited component. The tFileExcelSheetList is the only component that I know that can give me the sheet list as a variable such as- (String)globalMap.get("tFileExcelSheetList_1_SHEET_NAME"))
2.Defining  (String)globalMap.get("row1.sheetName") in the column of tFileInputDelimited I'm not sure where the value for sheetName is coming from.
Thanks
Anonymous
Not applicable
Author

Hi 
If the sheet names are known and fixed, you can write them in a file and use tFileInputDelimited to read them. For example, a file contains the sheet names like:
sheet1
sheet2
...

Then, use a tFlowToIterate to iterate each sheet name, or use a tForEach to replace tFileInputDelimited-main->tFlowToIterate.