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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error in tSampleRow ("The method split(String) is invalid...")

In my job, I'm pulling files from a database, and wanting to divide full number of rows by four. I output each quarter of rows to a separate file. Here's my job:


0683p000009MGi6.png



In order to do this, I'm using a tJavaFlex component, which increments a variable by 1 for every value in ColumnA that isn't null, and then places that value in a global variable using globalMap.put(). Here's the code:

0683p000009MGp2.png


What I'm trying to do is call this variable in a tSampleRow component, with the following code:


0683p000009MGly.png





When I try to run the job, I get the following error:

0683p000009MGq9.png






Am I attempting to do something impossible? If not, what is my mistake? I'm not sure what value in my job has a type of Object. 


Thanks in advance for the help.

Labels (2)
5 Replies
Anonymous
Not applicable
Author

Hello,
I am not sure but the error talks about a type "Object", so maybe when you call your globalMap you have to "prefix" it with the return type of the get like that :
(String) globalMap.get("HFScount")

I hope this answer can help you.
Anonymous
Not applicable
Author

tdz,
Thank you for the suggestion. When I make the change you advised, I get the following error message: "Type mismatch: cannot convert from String to String[]".
Anonymous
Not applicable
Author

Oups, sorry for the mistake, I think you have to cast the result of the globalMap in Integer (and not in String) like that :
(Integer) globalMap.get("HFScount")
Anonymous
Not applicable
Author

tdz,
This results in the following error message: "The method split(String) is undefined for the type Integer".
Anonymous
Not applicable
Author

sdvorak wrote:
tdz,
Thank you for the suggestion. When I make the change you advised, I get the following error message: "Type mismatch: cannot convert from String to String[]".

Hello sdvorak,

Could you please show us how and where you use the split method which is mentioned in your first post ?
Thank you.