Converting Text File to String

Hey guys!! I’m trying to pass the contents of a text file to a string. I’m using the ReadTextFile activity, I provide the file name and output variable–testStringVar. I use a log activity to make sure the contents are being read, and they are, I see the contents on the ouput panel. Then I’m passing testStringVar to another activity that requires a string and I get --Write Line: Object reference not set to an instance of an object. Can anyone help with this? thank you!!

Hmm if the output variable obtained from read text file activity is what been mentioned in the write line activity then we won’t get any error
Ensure once that same string variable is mentioned
Or if possible can I have a view on the workflow with a screenshot

Cheers @Russygrl

@Palaniyappan here is the xaml file and I put a comment for you inside it. thank you!WatsonToneAnalyzer.xaml|attachment (10.9 KB)

WatsonToneAnalyzer.xaml (10.9 KB)

Can I have a screenshot if possible
I don’t have system around me right now
That’s why buddy
Cheers @

ok here you go.

Here the output panel shows the output right
I hope you are good With this
Cheers @Russygrl

yea that is the output of the text file. just a sentence since im testing

here’s is the properties panel for watson

So the issue you are facing is …@Russygrl
Fine may I know what is commented out

here you go

Are you having the error at the write line after Analyze General Tone activity?

yes, here is what happens when I run it using the string variable from the read text file activityForum4

Read text file has output variable as WatsonTextFile While in writeline it’s mentioned as ibmTone.ToneName

Cheers @

This doesnt seem like a problem with the string.
I guess the response from Analyze General Tone for the text in text file (that you store as ibmTone) is a null value. So when you try to get the ibmTone.ToneName, this throws the exception.

Try adding this on the variables pane.

ok gonna try

Hey guys I get almost the same resultforum5

the variables ibmTone and ibmSentenceTones don’t need to be changed because these are the variables through which the sentiments are passed.

You got an empty line written on the output console. So what I said her seems to be true :

Now your problem is the same everywhere. Initialize the new object for every variable on the variables pane. Your problem should be solved.

@kaderms I made the changes and keep getting the same.