$read function usage

Questions and answers on how to get the most out of FFAStrans
Post Reply
kimble
Posts: 24
Joined: Mon Apr 11, 2016 9:35 pm

$read function usage

Post by kimble »

Hello,

Me again with another question.

I am trying to read the contents of a txt file with the $read function and store it as a var with the populate variables processor.

I have this configured as:

set user variable %s_watermark% to $read("%recursed_path~1\watermark.txt)

I can see this gets picked up in the logs as:

"split_id": "1-0-0",
"event": "pre_evaluation",
"type": "trace",
"context": "node execution",
"host": "redacted",
"data": {
"name": "s_watermark",
"data": "_MyFileRead(\"foldername\\watermark.txt\")"
}

But the data then looks empty:

"split_id": "1-0-0",
"event": "populate_variable",
"type": "trace",
"context": "node execution",
"host": "redacted",
"data": {
"name": "s_watermark",
"type": "string",
"data": ""
}


Any ideas what I am doing wrong, the file is there and with some text in. Am I missing some key step to have the txt file contents read and stored?

Thank you,

Neil
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: $read function usage

Post by emcodem »

Is there really a quote missing in this?

Code: Select all

$read("%recursed_path~1\watermark.txt)
emcodem, wrapping since 2009 you got the rhyme?
kimble
Posts: 24
Joined: Mon Apr 11, 2016 9:35 pm

Re: $read function usage

Post by kimble »

Sorry, that's my mistake. I am using:

$read("%s_recursed_path~1%\watermark.txt")
kimble
Posts: 24
Joined: Mon Apr 11, 2016 9:35 pm

Re: $read function usage

Post by kimble »

My mistake, I forgot to pass the full path in, the recursed path didn't include the host/initialpath.
Post Reply