BMC Atrium Discovery Community Forum

forgot password?
   
 
Verify if result is a number - how? [SOLVED]
Posted: 20 June 2012 06:29 AM   [ Ignore ]  
RankRankRankRank
Guru
Total Posts:  151
Joined:  2011-04-19

Hi,

I’m trying to accomplish something simple, but that has got me stuck. I have a list of values, integers, as well as the value of None.

Now, I wish to only continue to work with the integers, I’m trying to accomplish something similar as this:

for a in list do
    if 
not a matches regex 'None' then


    end 
if;
end for; 

However, matches expects a string or buffer, which causes a bunch of exceptions. How can I solve this?

(Something good for the future is perhaps to release a Python API for Discovery, don’t re-invent the wheel with a new language)

Update: Uh, seems “None” is it’s own datatype for whatever reason, using a <> “None” does not seem to work either.

Update 2: So, “if a then” worked to filter out the “NoneType”.

[ Edited: 20 June 2012 06:43 AM by Anders Lauri]
Profile
 
 
Posted: 20 June 2012 06:42 AM   [ Ignore ]   [ # 1 ]  
BMC ADDM Staff
RankRankRankRank
Administrator
Total Posts:  1615
Joined:  2008-02-12

You could test for the value none, i.e.

if <> none then 

Something good for the future is perhaps to release a Python API for Discovery, don’t re-invent the wheel with a new language

This will not happen. TPL provides lots of automatic behaviour for maintaining expected state in ADDM. Without TPL considerable knowledge would be necessary to not break things.

Profile
 
 
Posted: 20 June 2012 06:58 AM   [ Ignore ]   [ # 2 ]  
BMC ADDM Staff
RankRankRankRank
Administrator
Total Posts:  1615
Joined:  2008-02-12
Anders Lauri - 20 June 2012 06:29 AM

Update 2: So, “if a then” worked to filter out the “NoneType”.

This will not distinguish between none and the value 0.

Profile
 
 
Posted: 20 June 2012 07:01 AM   [ Ignore ]   [ # 3 ]  
RankRankRankRank
Guru
Total Posts:  151
Joined:  2011-04-19
Andrew Waters - 20 June 2012 06:58 AM
Anders Lauri - 20 June 2012 06:29 AM

Update 2: So, “if a then” worked to filter out the “NoneType”.

This will not distinguish between none and the value 0.

Alright, good to know. However, in this case, 0 is something I can disregard anyhow.

Profile
 
 
   
 
 
‹‹ Patten      How to hide a custom attribute ? ››