Page 1 of 1

$read function usage

Posted: Mon Oct 09, 2023 2:08 pm
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

Re: $read function usage

Posted: Mon Oct 09, 2023 2:43 pm
by emcodem
Is there really a quote missing in this?

Code: Select all

$read("%recursed_path~1\watermark.txt)

Re: $read function usage

Posted: Mon Oct 09, 2023 4:42 pm
by kimble
Sorry, that's my mistake. I am using:

$read("%s_recursed_path~1%\watermark.txt")

Re: $read function usage

Posted: Mon Oct 09, 2023 6:58 pm
by kimble
My mistake, I forgot to pass the full path in, the recursed path didn't include the host/initialpath.