Jump to content



Photo

Check Whole List If Word Is In The List, If Yes Alert Yes


  • Please log in to reply
1 reply to this topic

#1 spa3212

spa3212

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts
  • OS:Windows 8
  • Total Memory:2Gb
  • Framework:v3.5
  • License:Community Edition

Posted 15 April 2018 - 11:56 PM

hello friends please help...I searched a lot but couldn't found a solution..

 

here is the code..

 

loop($list total(%forbidden)) {
    if($contains($document text,$list item(%forbidden,#forbidpost))) {
        then {
            alert("yes")
        }
        else {
            alert("no")
        }
    }
    increment(#forbidpost)
}

 

 

1. I have a list of 10 words that I want to see if present on a webpage or not

2. But before if command say yes or not, I want it to check whole list, 

 

currently this code, that I put in loop, check every line of text file, it alert no even if word is there on 6th line. 

 

How can I check a whole list for existence of a word before it alert

 



#2 HelloInsomnia

HelloInsomnia

    Advanced Member

  • Moderators
  • 2790 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 16 April 2018 - 09:18 AM

You can set a variable before the loop and then alert it after the loop like so:

set(#forbidden,"no","Global")
loop($list total(%forbidden)) {
    if($contains($document text,$list item(%forbidden,#forbidpost))) {
        then {
            set(#forbidden,"yes","Global")
        }
        else {
        }
    }
    increment(#forbidpost)
}
alert(#forbidden)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users