forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Check a group of variables for @null?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Fri Mar 25, 2005 8:55 pm    Post subject: Check a group of variables for @null? Reply with quote

Is there a way to check to see if a group of variables is null all at once?
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Mar 25, 2005 9:01 pm    Post subject: Reply with quote

To my knowledge you'll have to write a separate function to do this. You could also, as each variable get "used", add it to a list in a specific order, your chioce, and then periodically check the list for any empty lines.
_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
webdaddy
Contributor
Contributor


Joined: 14 Nov 2004
Posts: 151
Location: Raleigh NC

PostPosted: Fri Mar 25, 2005 11:45 pm    Post subject: Variables Reply with quote

I usually create a loop and then check them all at once using the loop. Dont know if that was what you were referring to or not. But another thought about how you can check a series of variables.
_________________
K Wetzel
Programming - Technology - Communications
"The Home of the SLC Security Console"
SLC now available for Linux...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Sat Mar 26, 2005 9:41 am    Post subject: Reply with quote

If you need them all to be null just do:

Code:
if @null(%A%B%%fred%%joe)
  info Variables are all null
end

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Tue Mar 29, 2005 6:11 pm    Post subject: Reply with quote

jules wrote:
If you need them all to be null just do:

Code:
if @null(%A%B%%fred%%joe)
  info Variables are all null
end


Thanks jules! The help says nothing about it accepting more than one variable. Guess I should have just tried it...
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Tue Mar 29, 2005 6:24 pm    Post subject: Reply with quote

I think that what is happening here, is that if any of the variables included in
the parenthesis have a value, then @null() will return FALSE. It isn't
explicitly checking each variable for NULL.

Nice approach though Jules. Wink

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
flypaper
Contributor
Contributor


Joined: 19 Oct 2001
Posts: 104

PostPosted: Tue Mar 29, 2005 6:51 pm    Post subject: Reply with quote

jules wrote:
If you need them all to be null just do:

Code:
if @null(%A%B%%fred%%joe)
  info Variables are all null
end


Whoops. I want to make sure that none of them are null, so that won't work. Sorry if I wasn't specific enough.
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Mar 30, 2005 8:06 am    Post subject: Reply with quote

Ah! You want to test if none of a group of variables is null!

I can't think of an easy way to do this. You have:

Code:
if @both(%A,%B)


which would test if two of them were not null, but there is no:

Code:
if @all(%A,%B,...)


I think the neatest way would be to write a function:

Code:
:testnotnull
  if %1
    if %2
      if %3
        %R = 1
      end
    end
  end
  exit %R

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group