Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Trouble with Tree Control and Mapped Table

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trouble with Tree Control and Mapped Table

    Has anyone tried creating a Tree Control against a Mapped Table? I've been fighting this part time for about 4 days now.

    I have a Mapped Table which includes 3 fields from 1 file and 1 field from another file.

    I don't get any error messages, it is simply that the Tree Control won't expand. I have narrowed it down to the 1 field outside of the primary file in the Mapped Table. To verify the problem with the Mapped Table, I modified my primary file (Schedule_raw) to include the field (full_name_short) from the secondary file (Staff) and filled the field with an operation. Using the newly modified file, the Tree Control expands as expected.

    Unfortunately, the only example of dynamically loading a tree (in the learning xdialog base) only expands as the branch is selected. I've worked with it enough to fry my brain.

    Judging from other threads, I'm sure the question will be asked "Why are you using a Tree Control?"

    For this particular file, it takes 3 fields to uniquely identify a record: Week_Ending, Employee_ID (or name) and Position. I suppose I could use 3 drop down lists to accomplish the same thing but the Tree Control seems more efficient from a user viewpoint. My intent is to return the 3 variables to query the file for schedule changes. If anyone knows of a better mouse trap, I am open to suggestion(s).

    If needed, I can supply a zipped database but it should be easy to recreate from any application.

    I will send a bug report if it can be verified by someone else.

    Jerry Gray

    #2
    Re: Trouble with Tree Control and Mapped Table

    Originally posted by Jerry Gray View Post
    Has anyone tried creating a Tree Control against a Mapped Table? I've been fighting this part time for about 4 days now.

    I have a Mapped Table which includes 3 fields from 1 file and 1 field from another file.

    I don't get any error messages, it is simply that the Tree Control won't expand. I have narrowed it down to the 1 field outside of the primary file in the Mapped Table. To verify the problem with the Mapped Table, I modified my primary file (Schedule_raw) to include the field (full_name_short) from the secondary file (Staff) and filled the field with an operation. Using the newly modified file, the Tree Control expands as expected.

    Unfortunately, the only example of dynamically loading a tree (in the learning xdialog base) only expands as the branch is selected. I've worked with it enough to fry my brain.

    Judging from other threads, I'm sure the question will be asked "Why are you using a Tree Control?"

    For this particular file, it takes 3 fields to uniquely identify a record: Week_Ending, Employee_ID (or name) and Position. I suppose I could use 3 drop down lists to accomplish the same thing but the Tree Control seems more efficient from a user viewpoint. My intent is to return the 3 variables to query the file for schedule changes. If anyone knows of a better mouse trap, I am open to suggestion(s).

    If needed, I can supply a zipped database but it should be easy to recreate from any application.

    I will send a bug report if it can be verified by someone else.

    Jerry Gray
    please send a bug report with an attached file that allows us to duplicate the problem.

    there is one outstanding bug report on mapped tables involving a mapped table that joins two tables. When fields from the child table are used in a report, the wrong value is shown.

    There is another outstanding bug report that involves an embedded browse on a form that displays a mapped table. the embedded browse displays fine, but if you put fields from the table on the form itself (not in the embedded browse), the browse and the stand-alone field are not synchronized as they should be. both bugs reports are actually the same bug. these bugs are on the bug list and will be fixed shortly.

    it is possible that your bug is also actually the same as the two reported bugs, but we won't know until we see your example.

    Comment


      #3
      Re: Trouble with Tree Control and Mapped Table

      Selwyn,

      I wanted to do some more work before I sent a bug report. I'm glad I did, as I find that my tree works the same for both a Mapped Table and a Set.

      I am still having problems but it doesn't appear to be linked to the Mapped Table.

      The problem I'm having is that the tree expands properly for the week_ending date so it shows one record for each date. When a date branch is opened, it lists all of the records, not just the records for that date. This is my first venture into the trees and I must confess I'm thoroughly confused and afraid I've lost my way.

      The file sche_w_name is a mapped table using schedule_raw as the primary file and staff as the second file. There are multiple records for each week_ending date. Within those records, a staff member can have multiple records, determined if they work in multiple positions. Each staff record can have only one position. I expect the tree to look something like:

      Code:
       
      week_ending
        |_>full_name_short
          |_>Position (i.e.Floor)
          |_>Position (i.e.Deal)
        |_>full_name_short
          |_>Position (i.e. Floor)
      etc...
      I need to return the values for week_ending, employee_id and position to retrieve the record from schedule_raw for changes. It takes all three fields to uniquely identify the record.

      I have attached a zipped database if someone wants to give me some pointers.

      This is the script (Select_X_Mapped)for the tree. It started as Selwyn's example from Learning Xdialog, Lesson 12 - Tree Controls, "Select a customer - Populate dynamically from a table" example.

      Code:
      'Date Created: 28-Jun-2006 09:07:04 AM
      'Last Updated: 16-Apr-2008 06:59:00 AM
      'Created By  : Selwyn
      'Updated By  : Owner
      dim filterExpn as c
      dim orderExpn as c 
      dim contentExpn as c 
      dim tablename as c 
      tablename = "sche_w_name"
      contentExpn = "alltrim(dtoc(week_ending))+'|{EXPAND=Expanding tree...}!expandSname('+quote(alltrim(dtoc(week_ending)))+')'"
      filterExpn = "week_ending<> {  /  /  } .and.unique_key_value()"
      orderExpn = "week_ending" 
      dim treeList as c 
      treeList = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
      dim selected as c = ""
      'The enable expression for the OK button looks to see if the 'selected' variable starts with 'ID:'
      'If so, then we know we are at an endpoint in the tree.
      dim flagOK as l = .f.
      ui_dlg_box("Select Employee",<<%dlg%
      [%X;S=BLR;D="|"%.50,20selected^<treelist];
      {justify=right}
      <10&OK!ok?left(selected,3)="ID:"> <Cancel>;
      %dlg%,<<%code%
      if a_dlg_button ="ok" then 
       flagOK = .t.
      end if 
      %code%)
       
      if flagOK = .t. then 
       ui_msg_box("","You selected employee number: " + substr(selected,5))
       
      end if 
       
      function expandSname as c (Sname as c )
      ui_yield()
      dim filterExpn as c
      dim orderExpn as c 
      dim contentExpn as c 
      dim tablename as c 
      tablename = "sche_w_name"
      contentExpn = "alltrim(full_name_short)+'|{EXPAND=Expanding tree...}!expandPost('+ alltrim(Position) +')'"
      filterExpn = "unique_key_value() .and. full_name_short=" + quote(Sname)
      orderExpn = "week_ending" + "Sname"
      expandSname = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
      if expandSname = "" then 
       expandSname = "<None>"
      end if 
       
      end function
       
      function expandPost as c (post as c )
      ui_yield()
       
      dim filterExpn as c
      dim orderExpn as c 
      dim contentExpn as c 
      dim tablename as c 
      tablename = "sche_w_name"
      contentExpn = "alltrim(Position)"
      filterExpn = "unique_key_value() .and. Position=" + quote(post)
      orderExpn = "Position"
      expandPost = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
      if expandPost = "" then 
       expandPost = "<None>"
      end if 
       
      end function
      Thanks in advance,
      Jerry Gray

      Comment


        #4
        Re: Trouble with Tree Control and Mapped Table

        Originally posted by Jerry Gray View Post
        Selwyn,

        I wanted to do some more work before I sent a bug report. I'm glad I did, as I find that my tree works the same for both a Mapped Table and a Set.

        I am still having problems but it doesn't appear to be linked to the Mapped Table.

        The problem I'm having is that the tree expands properly for the week_ending date so it shows one record for each date. When a date branch is opened, it lists all of the records, not just the records for that date. This is my first venture into the trees and I must confess I'm thoroughly confused and afraid I've lost my way.

        The file sche_w_name is a mapped table using schedule_raw as the primary file and staff as the second file. There are multiple records for each week_ending date. Within those records, a staff member can have multiple records, determined if they work in multiple positions. Each staff record can have only one position. I expect the tree to look something like:

        Code:
         
        week_ending
          |_>full_name_short
            |_>Position (i.e.Floor)
            |_>Position (i.e.Deal)
          |_>full_name_short
            |_>Position (i.e. Floor)
        etc...
        I need to return the values for week_ending, employee_id and position to retrieve the record from schedule_raw for changes. It takes all three fields to uniquely identify the record.

        I have attached a zipped database if someone wants to give me some pointers.

        This is the script (Select_X_Mapped)for the tree. It started as Selwyn's example from Learning Xdialog, Lesson 12 - Tree Controls, "Select a customer - Populate dynamically from a table" example.

        Code:
        'Date Created: 28-Jun-2006 09:07:04 AM
        'Last Updated: 16-Apr-2008 06:59:00 AM
        'Created By  : Selwyn
        'Updated By  : Owner
        dim filterExpn as c
        dim orderExpn as c 
        dim contentExpn as c 
        dim tablename as c 
        tablename = "sche_w_name"
        contentExpn = "alltrim(dtoc(week_ending))+'|{EXPAND=Expanding tree...}!expandSname('+quote(alltrim(dtoc(week_ending)))+')'"
        filterExpn = "week_ending<> {  /  /  } .and.unique_key_value()"
        orderExpn = "week_ending" 
        dim treeList as c 
        treeList = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
        dim selected as c = ""
        'The enable expression for the OK button looks to see if the 'selected' variable starts with 'ID:'
        'If so, then we know we are at an endpoint in the tree.
        dim flagOK as l = .f.
        ui_dlg_box("Select Employee",<<%dlg%
        [%X;S=BLR;D="|"%.50,20selected^<treelist];
        {justify=right}
        <10&OK!ok?left(selected,3)="ID:"> <Cancel>;
        %dlg%,<<%code%
        if a_dlg_button ="ok" then 
         flagOK = .t.
        end if 
        %code%)
         
        if flagOK = .t. then 
         ui_msg_box("","You selected employee number: " + substr(selected,5))
         
        end if 
         
        function expandSname as c (Sname as c )
        ui_yield()
        dim filterExpn as c
        dim orderExpn as c 
        dim contentExpn as c 
        dim tablename as c 
        tablename = "sche_w_name"
        contentExpn = "alltrim(full_name_short)+'|{EXPAND=Expanding tree...}!expandPost('+ alltrim(Position) +')'"
        filterExpn = "unique_key_value() .and. full_name_short=" + quote(Sname)
        orderExpn = "week_ending" + "Sname"
        expandSname = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
        if expandSname = "" then 
         expandSname = "<None>"
        end if 
         
        end function
         
        function expandPost as c (post as c )
        ui_yield()
         
        dim filterExpn as c
        dim orderExpn as c 
        dim contentExpn as c 
        dim tablename as c 
        tablename = "sche_w_name"
        contentExpn = "alltrim(Position)"
        filterExpn = "unique_key_value() .and. Position=" + quote(post)
        orderExpn = "Position"
        expandPost = table.external_record_content_get(tablename,contentExpn,orderExpn,filterExpn)
        if expandPost = "" then 
         expandPost = "<None>"
        end if 
         
        end function
        Thanks in advance,
        Jerry Gray


        I have not studied your example in detail, but if you look at the contents of your tree control when it is originally displayed, the string variable 'treelist' looks like this:


        Code:
        4/06/2008|{EXPAND=Expanding tree...}!expandSname("04/06/2008")
        04/13/2008|{EXPAND=Expanding tree...}!expandSname("04/13/2008")
        04/20/2008|{EXPAND=Expanding tree...}!expandSname("04/20/2008")
        this makes sense. it means than when you expand an entry (say the entry for 4/06/2008), the function 'expandSname()' will be called and '04/06/2008' will be passed into the function).

        on the other hand, after you exapand one of the top nodes, the 'treelist' variable looks like this:

        Code:
        04/06/2008|Darlene Soub|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Terry Tanner|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Christina Dossier|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Leilani Colder|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Tommy Garish|{EXPAND=Expanding tree...}!expandPost(Floor)
        ......
        04/06/2008|Denise Runner|{EXPAND=Expanding tree...}!expandPost(Deal)
        04/06/2008|John Dunlope|{EXPAND=Expanding tree...}!expandPost(Deal)
        04/06/2008|Alice Wonder|{EXPAND=Expanding tree...}!expandPost(Deal)
        04/13/2008|{EXPAND=Expanding tree...}!expandSname("04/13/2008")
        04/20/2008|{EXPAND=Expanding tree...}!expandSname("04/20/2008")

        this does NOT make sense.

        it says that when you expand a second level node, the following function call will be made:

        expandPost(Floor)

        this will fail because there (presumably) is no variable called 'floor'.

        I can't say for sure what you meant to do, but I presume you might have meant:

        expandPost("Floor")

        Howevever, even that does not seem to make sense as why would same function call be used for multiple people?

        04/06/2008|Darlene Soub|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Terry Tanner|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Christina Dossier|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Leilani Colder|{EXPAND=Expanding tree...}!expandPost(Floor)
        04/06/2008|Tommy Garish|{EXPAND=Expanding tree...}!expandPost(Floor)

        Comment


          #5
          Re: Trouble with Tree Control and Mapped Table

          Selwyn,

          When I looked at your example, it was a 3 level tree, State, City and Customer.

          My data is 3 levels, Date, Name and Position.

          The original tree level is Week_ending date which is expanded with the function expandSname. Names are expanded with the function expandPost.

          Most names will have a single position record for each week. The first person who has 2 positions is Maria Wind.

          I would think the records would have to be sorted so the two records for Maria Wind would be together in order for the expansion to work but they aren't. The second record for Maria Wind is positioned further down in the table. Also the names are not specific to the date selected in the tree.

          The casino industry is a strange bird. A person can have several jobs at different pay rates (even different departments but we don't need to go there). On the schedule for my department, we have Floor supervisors and Dealers. The multiple position people are called Dual Rates; Floor supervisors some days and Dealers on the others.

          For my development, I am working with a single shift schedule. It consists of 5 Floor Supervisors, 10 Dual Rates and 24 dealers. 5 + 10 + 10 + 24 = 49 records for 1 shift each week. A full schedule for this casino department would normally be around 120 records per week. Later, I will add a 4th level to the tree to show the shift the person works. I will probably do this as the top level.

          If this gets applied to a large casino, there can be 600 to 800 records per week for the table games department.

          Thanks for taking a look. I'm going to keep working on it, learning as I go.

          Jerry Gray

          Comment


            #6
            Re: Trouble with Tree Control and Mapped Table

            Originally posted by Jerry Gray View Post
            Selwyn,

            When I looked at your example, it was a 3 level tree, State, City and Customer.

            My data is 3 levels, Date, Name and Position.

            The original tree level is Week_ending date which is expanded with the function expandSname. Names are expanded with the function expandPost.

            Most names will have a single position record for each week. The first person who has 2 positions is Maria Wind.

            I would think the records would have to be sorted so the two records for Maria Wind would be together in order for the expansion to work but they aren't. The second record for Maria Wind is positioned further down in the table. Also the names are not specific to the date selected in the tree.

            The casino industry is a strange bird. A person can have several jobs at different pay rates (even different departments but we don't need to go there). On the schedule for my department, we have Floor supervisors and Dealers. The multiple position people are called Dual Rates; Floor supervisors some days and Dealers on the others.

            For my development, I am working with a single shift schedule. It consists of 5 Floor Supervisors, 10 Dual Rates and 24 dealers. 5 + 10 + 10 + 24 = 49 records for 1 shift each week. A full schedule for this casino department would normally be around 120 records per week. Later, I will add a 4th level to the tree to show the shift the person works. I will probably do this as the top level.

            If this gets applied to a large casino, there can be 600 to 800 records per week for the table games department.

            Thanks for taking a look. I'm going to keep working on it, learning as I go.

            Jerry Gray

            You might find it helpful to take the 'tree_selectCustomer' script in learning xdialog and underneath the actual tree control, put a button:

            <show>


            then in the event handler section put this:


            if a_dlg_button = "show" then
            a_dlg_button = ""
            showvar(treeList)
            end if


            now run the script and each time after you expand a node, click the button to see what's in the tree.

            this makes is much easier to figure out what's going on.

            it is really actually quite simple. the functions are executed to dynamically expand the tree. you should be able to test the functions that you write independently of the tree to make sure that the function calls are returning the correct data.

            Comment


              #7
              Re: Trouble with Tree Control and Mapped Table

              Thanks Selwyn. That will help as it is trial and error at this point.

              Jerry Gray

              Now I can see how it's being built. Thanks again!

              Comment

              Working...
              X