hexagon logo

Count ELE objects


Can someone help me please. How can count how many ELE objects there are in my LDB, and then with a loop export the name of each ELE object to a txt file? thanks
Cristian
Parents
  • Hi,

    There are many ways you can do this, but to answer the question you describe you can do the following:

    Finding how many ELE objects exist in the LDB
    1. Define a QUE for all ELE objects using the wildcard LDBELE:*()
    2. Test the QUE for the number of entries using TESTMRB
     DFNQUE      (NAM=$ObjectsELE, MBR=LDBELE:*(), DEL=Y)
     TESTMBR     (REA=ObjectsNum, QUE=$ObjectsELE)
    


    Once you have the variable [[B]ObjectsNum[/B]] containing how many objects are in the LDBELE. You can then loop through and put the names to a text object.

    Putting the element names to a text object

    1. Delete the text object that receives the names so it is clean each run using DELTXT
    2. Initialise a new text object to receive the names using EDIT
    3. Start a Loop that runs from 0 to the number of elements-1 using the variable from the steps above
    4. Get the name of an object from the QUE using the loop index (Starting at the bottom of the QUE) ​ using CVNAMCHS
    5. Convert the string received by the step above to a line in a text object using CVSTRTXT
    DELTXT   (NAM=Output, CNF=N)
    EDIT     (NAM=Output, TYP=TXT, CRE=Y)
      DO       (NAM=X$$, BGN=0, END=ObjectsNum-1, DLT=1)
          CVNAMCHS    (CHS=~Get$Name, NAM=$ObjectsELE(-ObjectsNum+X$$))
          CVSTRTXT    (TXT=Output, LIN=999, STR=~Get$Name)
      ENDD
    


    The result of this will be a text object in the Quindos LDB that contains all the names of the objects in LDBELE.
    You can then export the text object.

    OPEN   (FIL=*YourFilePathHere*, DEV=D1, STA=NEW, ACC=A)
      OUTPUT (NAM=Output, DEV=D1, TYP=TXT)
    CLOSE
    


    There are several ways you can do it, but this is method follows closely what you originally described.
    The result will look something like this...


    Attached Files
Reply
  • Hi,

    There are many ways you can do this, but to answer the question you describe you can do the following:

    Finding how many ELE objects exist in the LDB
    1. Define a QUE for all ELE objects using the wildcard LDBELE:*()
    2. Test the QUE for the number of entries using TESTMRB
     DFNQUE      (NAM=$ObjectsELE, MBR=LDBELE:*(), DEL=Y)
     TESTMBR     (REA=ObjectsNum, QUE=$ObjectsELE)
    


    Once you have the variable [[B]ObjectsNum[/B]] containing how many objects are in the LDBELE. You can then loop through and put the names to a text object.

    Putting the element names to a text object

    1. Delete the text object that receives the names so it is clean each run using DELTXT
    2. Initialise a new text object to receive the names using EDIT
    3. Start a Loop that runs from 0 to the number of elements-1 using the variable from the steps above
    4. Get the name of an object from the QUE using the loop index (Starting at the bottom of the QUE) ​ using CVNAMCHS
    5. Convert the string received by the step above to a line in a text object using CVSTRTXT
    DELTXT   (NAM=Output, CNF=N)
    EDIT     (NAM=Output, TYP=TXT, CRE=Y)
      DO       (NAM=X$$, BGN=0, END=ObjectsNum-1, DLT=1)
          CVNAMCHS    (CHS=~Get$Name, NAM=$ObjectsELE(-ObjectsNum+X$$))
          CVSTRTXT    (TXT=Output, LIN=999, STR=~Get$Name)
      ENDD
    


    The result of this will be a text object in the Quindos LDB that contains all the names of the objects in LDBELE.
    You can then export the text object.

    OPEN   (FIL=*YourFilePathHere*, DEV=D1, STA=NEW, ACC=A)
      OUTPUT (NAM=Output, DEV=D1, TYP=TXT)
    CLOSE
    


    There are several ways you can do it, but this is method follows closely what you originally described.
    The result will look something like this...


    Attached Files
Children
No Data