Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


To know the length of a structure.

Posted on 2011-03-17
Medium Priority
Last Modified: 2013-12-26
pb 10.5

If a structure contains 5 items then the length of the structure is 5.

What is the command to find the length of a structure?
Question by:Mehram
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 35164355
I don't fully understand the question.  Can you post an example structure definition along with what you would expect the 'length' to be?

Author Comment

ID: 35165358
Take this strucure

global type str_menu from structure
      distr_acc_menu            m_distr_acc_menu
      distr_menu            m_distr_menu
      distr_setup_menu            m_distr_setup_menu
      distr_pur_sales_menu            m_distr_pur_sales_menu
end type

there are 4 menu items in this structure, hence the length is 4.

I want to know the length via script

Accepted Solution

lbushby earned 2000 total points
ID: 35165715
OK, I think you can do this using the ClassDefinition property e.g.

str_menu      lstr_structure
ClassDefinition                        ldc_classdefinition
VariableDefinition                  lvd_variabledefinition[]
integer                                          li_length

ldc_classdefinition = lstr_structure.ClassDefinition

lvd_variabledefinition[] = ldc_classdefinition.VariableList[]

li_length = UpperBound(lvd_variabledefinition[]) - 1

Author Closing Comment

ID: 35165806
Just like that!!!!

I love u!!!!

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question