Getting "relevance substitution error"

(imported topic written by SystemAdmin)

When I use the following code, I get an error on the bolded line. I also noticed that the file is not downloaded to the __Download folder or moved to the C:\temp. If I remove the bolded line, the download occurs and is moved to the correct folder. It seems that it is checking for the file even before the is downloaded. If I put the file in the c:\temp folder before executing the fixlet, the actions will complete successfully. Any ideas?

download http://:52311/Uploads//server_location_env/server_location_env.csv

continue if {exists file “server_location_env.csv” of folder “__Download”}

//Delete existing file and download the latest version.

delete “C:\temp\server_location_env.csv”

move “__Download\server_location_env.csv” “C:\temp\server_location_env.csv”

continue if {exists file “server_location_env.csv” of folder “c:\temp”}

if {exists line whose (preceding text of first “,” of it as lowercase = computer name as lowercase) of file (“C:\temp\server_location_env.csv”)}

Martin Carnegie

Gulf Breeze Software Partners

http://www.gulfsoft.com

(imported comment written by NoahSalzman)

That part looks right… error could be further on in the IF statement.

(imported comment written by SystemAdmin)

I took out all the code between the if else elseif and just put comments and still had the issue. I also removed that if statement and everything following to see what would happen and the file would download and move to the c:\temp directory as expected.

BTW, I forgot to mention a couple things:

  1. the file will change on a daily basis so I cannot use prefetch since it requires the sha1/file size

  2. This is on 8.2. I have not tried on 8.1.

Thanks

Martin Carnegie

Gulf Breeze Software Partners

http://www.gulfsoft.com

(imported comment written by NoahSalzman)

Whoops. My test was not exactly what you had there. Try removing the parens around the file.

Q: exists line whose (preceding text of first “,” of it as lowercase = computer name as lowercase) of file “/tmp/foo”

A: True

Q: exists line whose (preceding text of first “,” of it as lowercase = computer name as lowercase) of file ("/tmp/foo)"

E: This expression could not be parsed.

(imported comment written by NoahSalzman)

I really

hate

not having a delete function in this Forum.

That wasn’t it. Just an early morning typo on my part.

Q: exists line whose (preceding text of first “,” of it as lowercase = computer name as lowercase) of file ("/tmp/foo")

A: True

(imported comment written by SystemAdmin)

Well I was able to work around this by adding an additional “if” statement. No idea why this works :slight_smile:

The new line was if {exists file “server_location_env.csv” of folder “c:\temp”}

======================================================

download http:
//<server>:52311/Uploads/Software_Servers/server_location_env/server_location_env.csv 

continue 

if 
{exists file 
"server_location_env.csv" of folder 
"__Download"
}   
//Delete existing file and download the latest version. delete 
"C:\temp\server_location_env.csv"   move 
"__Download\server_location_env.csv" 
"C:\temp\server_location_env.csv" 

continue 

if 
{exists file 
"server_location_env.csv" of folder 
"c:\temp"
}   

if 
{exists file 
"server_location_env.csv" of folder 
"c:\temp"
}   

if 
{exists parenthesized part 1 of matches (regex 
"^(.*),.*,.*,.*,.*,.*,.*,.*,.*,.*$") of (lines whose (it as lowercase contains computer name as lowercase) of file 
"c:\temp\server_location_env.csv")
} ... 

else ...   endif   

else ...   endif

======================================================

Any ideas?

Martin Carnegie

Gulf Breeze Software Partners

http://www.gulfsoft.com

(imported comment written by NoahSalzman)

That makes sense. The “is the file there?” test was not the first bit of Relevance getting substituted… jn the first version you were allowing the Relevance engine to start doing it’s work before it checked that the file existed.

(imported comment written by SystemAdmin)

I must be missing something. I had the “continue if {exists file …” before the “if exists parenthesized …”, the only difference was adding another check to see if the file exists. From what I can tell from the logs, it never evaluated the “continue if” statement or the downloads.

I am wondering if this is going to actually fix it (well workaround) or I am just getting lucky and the timing is just right that the download happens before the rest of the actions.

It seems that every other fixlet I have written has never had this issue as I have never had to do something quite like this. My impression was that it does line 1, then line 2, etc, not line 5, then line 1, etc.

Martin Carnegie

Gulf Breeze Software Partners

http://www.gulfsoft.com