QApp Python Script checking if GDT Table Variable is empty not working pythonic way?

  • 4 October 2022
  • 1 reply

Userlevel 1



I just ran into an interesting problem:


In Qapp, when I script a GDT Variable to check if a another GDT Table or Table Variable is empty, it does not work using pythonic way. How can I get to check if a Table Attribute (list) is empty or not without coming up with other creative solutions? Basically, the Attribute (list) or Table appears to never be empty despite containing no data.


BID Table has _device, id and mac_limit attributes.

GDT Table has attribute “note” that I use for scripting.

When I check if BID Table (list) or attribute (list) is empty is doesn’t return true for empty using pythonic way:

#Check if (list) is empty:
if not $

  $cell = “PASSED: Bridge-Domains are not configured”.


Although empty, it doesn’t match and continues to go through next else statement: The value returned is “None”.


In the note, I run the following script:


    if $mpls_ldp is None:

        $cell = "NOT APPLICABLE: Device is not a PE Device."


        if not $

            $cell = "PASSED: Bridge-Domains are not configured."


            code = 0

            result = []

            rc = $BID.GetRowCount()

            for x in range(rc):

                if $BID.mac_limit[x] is None:

                    code = code + 1

                    result.append("FAILED: " + str($[x]) + " does not have a MAC address limit configured.")


            if code == 0:

                $cell = "PASSED: All Bridge-Domains have a MAC address limit configured."


                $cell = '\n'.join(result)



    $cell = "NOT REVIEWED: Unable to validate configuration."


Qapp with BID Table having content:


BID Table without content:


GDT Table, note variable showing “NONE” from $ attribute (list) output, despite being empty:





Best answer by dawal1337 4 October 2022, 16:23

View original

1 reply

Userlevel 1

I think I have found a workaround to my problem. It seems to work using the following method:


test = [None]

if $ == test:

<code below>


» returns True, if list is empty.

» returns False, if not empty.



Community |  Ideas

Facebook |  Instagram |  Youtube |  Twitter |  LinkedIn
Privacy & Security Statement  |  Terms & Conditions |  Impressum  |  UK Modern Slavery Statement