Set operations in Relevance

(imported topic written by miteshvasa91)

I want to obtain the list of folders in “C:\documents and settings” such that their last modified date is greater than a number specified in a config file and from this list, I want to exclude all those folders that are specified in that same config file.

elements of ((set of names of folders whose (now - modification time of it > (following texts of firsts "age | " of (lines starting with "age | " of file “c:\config.txt”) as integer)*day) of folder “C:\documents and settings” - set of names of logged on users) - set of following texts of firsts "exclude | " of (lines starting with "exclude | " of file “c:\config.txt”))

My config file looks like following:

age | 180

exclude | “Administrator”;“All Users”;“db2admin”

I am getting error in evaluating the above relevance. Even when I don’t include the above ‘set difference’ operations, I get error “the left operand of ‘*’ must be singluar”:

elements of (set of names of folders whose (now - modification time of it >(following texts of firsts "age | " of (lines starting with "age | " of file “c:\config.txt”) as integer)*day) of folder “C:\documents and settings”)

However, when I hard-code the list of exclusions and the age integer, it works fine.

elements of ((set of names of folders whose (now - modification time of it > 180*day) of folder “C:\documents and settings” - set of names of logged on users) - set of (“Administrator”;“All Users”))

Can someone help me with the relevance when I am reading from a config file ?

(imported comment written by Lee Wei)

Mitesh,

First of all, let me thank you for stating your questions so clearly, and congratulate you on having answered most of the questions yourself.

I think I just copied a few of you code fragments together.

You already have a working statement. All we have to do is to replace the static fragments in red with dynamic data.

elements of ((set of names of folders whose (now - modification time of it > color=red180[/color]*day) of folder “C:\documents and settings” - set of names of logged on users) - set of color=red(“Administrator”;“All Users”)[/color])

This is your statement to return the configuration for Age

(it as integer) of following text of firsts "age | " of lines starting with "age | " of file “c:\config.txt”

And the one to return a list of Excluded names

following texts of firsts "exclude | " of (lines starting with "exclude | " of file “c:\config.txt”)

So we can simply replace the static portion from the first statement with the dynamic ones.

elements of ((set of names of folders whose (now - modification time of it > color=red((it as integer) of following text of firsts "age | " of lines starting with "age | " of file “c:\config.txt”)[/color]*day) of folder “C:\documents and settings” - set of names of logged on users) - set of color=red(following texts of firsts "exclude | " of (lines starting with "exclude | " of file “c:\config.txt”))[/color])

Lee Wei

(imported comment written by miteshvasa91)

Thanks Lee for the prompt response. I tried the corrected relevance you gave and although the integer ‘age’ was read and executed correctly, the set difference operations didn’t seem to work. I am pasting below the output of the three individual relevance statements and then the output of the combined statement. Note that I was expecting ‘null’ or blank result.

Q: elements of (set of names of folders whose (now - modification time of it > ((it as integer) of following text of firsts "age | " of lines starting with "age | " of file “c:\config.txt”)*day) of folder “C:\documents and settings”)
A: Administrator
A: All Users
A: Default User
A: LocalService
A: NetworkService
A: db2admin
T: 6.736 ms

Q: elements of (set of names of logged on users)
A: administrator
T: 2.168 ms

Q: elements of (set of (following texts of firsts "exclude | " of (lines starting with "exclude | " of file “c:\config.txt”)))
A: “All Users”;“Default”;“Default User”;“Public”;“Administrator”;“db2admin”;“LocalService”;"NetworkService"
T: 1.128 ms

Q: elements of ((set of names of folders whose (now - modification time of it > ((it as integer) of following text of first "age | " of lines starting with "age | " of file “c:\config.txt”)*day) of folder “C:\documents and settings” - set of names of logged on users)- set of (following text of first "exclude | " of (lines starting with "exclude | " of file “c:\config.txt”)))
A: Administrator
A: All Users
A: Default User
A: LocalService
A: NetworkService
A: db2admin
T: 9.619 ms

Looks like the set difference operation did not work. Is it because it failed to create a ‘set’ from the relevance in the 3rd statement and created a ‘list’ instead ? Also note, that the output of second relevance above was in lower case.

(imported comment written by miteshvasa91)

Never mind, I resolved the problem by adding “substrings separated by ;” and “as lowercase” qualifiers to the statement. Also had to remove the double quotes from the config file. Thanks for your help. This was the final statement for anyone else looking here:

Q: elements of (set of (names of folders whose (now - modification time of it > ((it as integer) of following text of first "age | " of lines starting with "age | " of file “c:\config.txt”)*day) of folder “C:\documents and settings” as lowercase) - set of (names of logged on users as lowercase) - set of (substrings separated by “;” of following text of first "exclude | " of (lines starting with "exclude | " of file “c:\config.txt”) as lowercase))
T: 9.469 ms