Topic
  • 4 replies
  • Latest Post - ‏2013-09-20T14:57:15Z by IanR2974
IanR2974
IanR2974
16 Posts

Pinned topic If then else "it" reference error

‏2013-09-13T15:40:44Z |

Hello,

I am trying to tidy up my "if then else" relevance (the second Q:) by using it to reference 2 repeated strings, however when i use "it" it will fail when it can't find the file or the line.

Below are the results when i remove the line i am looking for:

Q: (IF (exists it) THEN ((if (exists it) then (exists (it whose (it does not contain "disabled"))) else FALSE) of line containing "svc:/application/graphical-login/cde-login" of it) ELSE TRUE) of file "C:\Test\testfile"
E: Singular expression refers to nonexistent object.
 
Q: (IF (exists file "C:\Test\testfile") THEN (if (exists line containing "svc:/application/graphical-login/cde-login" of file "C:\Test\testfile") then (exists (line containing "svc:/application/graphical-login/cde-login" of file "C:\Test\testfile") whose (it does not contain "disabled")) else FALSE) ELSE TRUE)
A: False
T: 0.632 ms
I: singular boolean

Any help here would be appreciated as the real pathnames are a lot longer.

thanks Ian

  • NoahSalzman
    NoahSalzman
    676 Posts
    ACCEPTED ANSWER

    Re: If then else "it" reference error

    ‏2013-09-16T17:12:38Z  
    • IanR2974
    • ‏2013-09-16T08:13:34Z

    Hi,

    Apologies i wasnt clear. What i am trying to achieve is 3 things:

    If the file "C:\Test\testfile" does not exist the relevance should return true.

    if the line "svc:/application/graphical-login/cde-login" does not exist it should return false

    if the line does exist it should contain "disabled" or should return true.

    The second relevance i posted does work, however the first one doesn't work as it doesnt seem to pick up the "it" refrenences which i was trying to use to tidy the relevance up.

    I hope this makes what i am trying to do more clearer.

     

    This should work:

     

     

    exists line whose (it contains "svc:/application/graphical-login/cde-login" and it does not contain "disabled") of file "c:\test\testfile" | true

  • NoahSalzman
    NoahSalzman
    676 Posts

    Re: If then else "it" reference error

    ‏2013-09-13T17:45:12Z  

    Could you explain what you are trying to accomplish? It's not clear from the examples.

    Does the following syntax help?

    q: (exists line containing "svc:/application/graphical-login/cde-login" of it and not exists line containing "disabled" of it) of file "c:\test\testfile"
    A: True

    q: (exists line containing "svc:/application/graphical-login/cde-login" of it and not exists line containing "login1" of it) of file "c:\test\testfile"
    A: False

    q: lines of file "c:\test\testfile"
    A: svc:/application/graphical-login/cde-login
    A: svc:/application/graphical-login/cde-login1
    A: svc:/application/graphical-login/cde-login2

     

  • IanR2974
    IanR2974
    16 Posts

    Re: If then else "it" reference error

    ‏2013-09-16T08:13:34Z  

    Could you explain what you are trying to accomplish? It's not clear from the examples.

    Does the following syntax help?

    q: (exists line containing "svc:/application/graphical-login/cde-login" of it and not exists line containing "disabled" of it) of file "c:\test\testfile"
    A: True

    q: (exists line containing "svc:/application/graphical-login/cde-login" of it and not exists line containing "login1" of it) of file "c:\test\testfile"
    A: False

    q: lines of file "c:\test\testfile"
    A: svc:/application/graphical-login/cde-login
    A: svc:/application/graphical-login/cde-login1
    A: svc:/application/graphical-login/cde-login2

     

    Hi,

    Apologies i wasnt clear. What i am trying to achieve is 3 things:

    If the file "C:\Test\testfile" does not exist the relevance should return true.

    if the line "svc:/application/graphical-login/cde-login" does not exist it should return false

    if the line does exist it should contain "disabled" or should return true.

    The second relevance i posted does work, however the first one doesn't work as it doesnt seem to pick up the "it" refrenences which i was trying to use to tidy the relevance up.

    I hope this makes what i am trying to do more clearer.

     

  • NoahSalzman
    NoahSalzman
    676 Posts

    Re: If then else "it" reference error

    ‏2013-09-16T17:12:38Z  
    • IanR2974
    • ‏2013-09-16T08:13:34Z

    Hi,

    Apologies i wasnt clear. What i am trying to achieve is 3 things:

    If the file "C:\Test\testfile" does not exist the relevance should return true.

    if the line "svc:/application/graphical-login/cde-login" does not exist it should return false

    if the line does exist it should contain "disabled" or should return true.

    The second relevance i posted does work, however the first one doesn't work as it doesnt seem to pick up the "it" refrenences which i was trying to use to tidy the relevance up.

    I hope this makes what i am trying to do more clearer.

     

    This should work:

     

     

    exists line whose (it contains "svc:/application/graphical-login/cde-login" and it does not contain "disabled") of file "c:\test\testfile" | true

  • IanR2974
    IanR2974
    16 Posts

    Re: If then else "it" reference error

    ‏2013-09-20T14:57:15Z  

    This should work:

     

     

    exists line whose (it contains "svc:/application/graphical-login/cde-login" and it does not contain "disabled") of file "c:\test\testfile" | true

    Thanks Noah

    This works a treat. :)