Alpha DevCon 2018
Results 1 to 13 of 13

Thread: Populate UX from a List

  1. #1
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,513

    Default Populate UX from a List

    I have been going around in circles now for hours trying all different ways of doing this.

    I have a UX component with multiple panels.
    I have a list which contains a button on each row in panel 1. The list is bound to table 1.
    When the button is pressed, I want to activate panel 2 which has an embedded object. This object is a UX dialog bound to table 1.
    I want to populate this UX dialog with partial data from the list.

    I have watched videos etc.. and I can not populate the UX dialog in panel 2. I can activate the panel, but the UX dialog is always empty.

    NOte: I probably should have titled this post as "Populate a UX Dialog from a Button in a List"

    Thank you,

    Ron

  2. #2
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,891

    Default Re: Populate UX from a List

    Trying to understand this a bit more. Both the List and the embedded UX are bound to the same table... table 1. If this is the case then you're working with exactly the same data with both UX components.

    If this is true, then would you not want to use the Detail View of the List to edit the data in the List?

    Nonetheless, if you're using a column layout in the List, then the button javascript can first use .setValue to fill in values in the embedded child UX... you just need to get a pointer to that child Alias. You set the alias of the embedded UX in the properties of the embedded control. Then you can use code like this...

    Code:
    var cUX = {dialog.Object}.getChildObject('UXCHILD'); //the alias of the embedded UX is UXCHILD
    cUX.setValue('FIRSTNAME','Davey');
    {dialog.object}.panelSetActive('PANELCARD_2');

  3. #3
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,513

    Default Re: Populate UX from a List

    Thanks Dave,

    If this is true, then would you not want to use the Detail View of the List to edit the data in the List?
    Up until now, I didn't even know I could do that.

    So I did play with the detail view, but I didn't like the way it was presented on the screen. I could probably make it work when I have more time to learn about the detail view.

    I'm setting up this app to run on an iPad.
    Your code example worked just great.

    That said, I think the real problem I was having was that I had a panelcard on the UX dialog I was calling.

    Anyways, I'm a happy camper now. Thanks again,

    Ron

  4. #4
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,891

    Default Re: Populate UX from a List

    If it's all the same table... and... you're building a mobile app... then you definitely want to use the List controls Detail View. You can set it up to look any way you like. They're just controls. The Detail View controls can be sitting in another panelcard. When you select a row from the List, you set your "detail view" panelcard active. Because the detail view controls are tied to the List control, they are auto populated with the List data.

    I believe it's exactly what you want to... and should use. You definitely want to spend time on it now.

  5. #5
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,513

    Default Re: Populate UX from a List

    Thanks Dave,

    I did revisit the detailed view and I did learn a lot more about the detail view. However; I wasn't able to get things working quite right. I'm beginning to suspect that my lack of knowledge about structuring the UX component is the fault. I think my structure resulted in getting server-side code conflicts, but I'm not sure. I think I've got too much going on in this one UX component.

  6. #6
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,891

    Default Re: Populate UX from a List

    You can have a lot going on in one UX... depending on what it is. If it's well structured, you can do a lot.

    Your prior structure of using a List and then an embedded UX both tied to the same table is not the way to go.

    For this part of it... do you just want to display a List control and be able to display/edit that data in controls? If do, then it's the List that controls the data flow. You do not have the detail view controls data bound outside the list. The are tied to the list. When data is edit in the detail view controls, those edits are sent to the List and the List handles the SQL update.

    Send me a pm here on the board and we can walk through it.

  7. #7
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,513

    Default Re: Populate UX from a List

    Hi Dave,

    Spurred on by your persistence, I spent quite a bit more time looking at using the detailed view. This is what I found.

    I'm using a DBF table and it looks like Alpha is not supporting synchronization with DBF tables. Their video shows server side events in the properties of the detailed view page, but server side events are no longer available on my detailed view page. I'm using Build 2999.

    If I had a server side event, I think it would be quite easy to write some xbasic code to update the table. Without server side events in the detailed view, I don't think it is possible.

    I'm not going to be using disconnected apps or anything fancy. This is just a simple app that will have a max of 2000 records. In all likely hood, maybe 10 entries a week. I'm just using the detailed view to edit the entry in case a spelling error is found or something needs to be changed. Once posted, no edits will be allowed.

    I know, I should move over to SQL. The problem is that I am trying to marry a simple little WEB app to a 20 year old desktop app that is vital to the company. If this experiment is successful, I will make a couple of more WEB apps.

    Thanks for the push,

    Ron

    If I can't make this work, then the company will most likely abandon Alpha and purchase industry specific commercially available software.

  8. #8
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,891

    Default Re: Populate UX from a List

    DBF is different world... much like a movie I just saw... however, I just created a List Control with Detail View against the AlphaSports Customers DBF table. I can make changes via the Detail View and synchronize. No code required.

  9. #9
    Member
    Real Name
    Todd
    Join Date
    Oct 2008
    Posts
    19

    Default Re: Populate UX from a List

    Quote Originally Posted by Davidk View Post
    DBF is different world... much like a movie I just saw... however, I just created a List Control with Detail View against the AlphaSports Customers DBF table. I can make changes via the Detail View and synchronize. No code required.
    What version/build of Alpha are you using?
    What is your connection string?
    I want to repeat your test.

  10. #10
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,891

    Default Re: Populate UX from a List

    I just walked through this with Ron, and the way I'd set mine up is by using an AlphaDAO Connection string. You can set up a List Control manually and are allowed to choose DBF as the data source. Doing this, it seems that edits are not carried through to the table. I've not looked into this yet, but will.

    But, if you choose a SQL Data source, then you can create an AlphaDAO connection string where your Connection Type is ODBC. Then, in the Data Source Name property, you have an Edit link. The Edit link takes you to the Windows ODBC Data Source Administrator.

    Select Add
    Select Microsoft dBase driver, and click Finish
    Now you're in the ODBC dBase Setup dialog
    Enter a Data Source Name of your choosing and a Description
    I left Version at dBase 5.0
    Uncheck "Use Current Directly" and the click Select Directory and navigate to your DBF files.

    It looks like the ODBC driver is truncating DBF field names at 10 characters, so you'll have to live with that.

  11. #11
    "Certified" Alphaholic
    Real Name
    Ronald Anusiewicz
    Join Date
    Oct 2000
    Location
    Southampton, MA
    Posts
    1,513

    Default Re: Populate UX from a List

    There is one drawback to using a connection string which may not matter.

    When you delete a DBF record, the record is not deleted until you pack the table. When using a connection string, you may delete the record. Looking at the DBF table does not show the deleted record. But when loading a grid using a connection string, the deleted record is visible. There is probably a way around this. The simple thing is to not allow deletes using a connection string to access a DBF file.

  12. #12
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Populate UX from a List

    in dbf the delete actually does not delete the record it only marks the flag deleted or may change one character at the beginning of the record.
    if you connect with odbc that field is not taken into consideration so you see the record.
    a work around will be to add a field to the dbf table, logical field, deleted, and fill it with yes/no ( default no ) or true/false (default false) then in the grid
    fashion the grid where that field is "no or false as the case may be" as the query string. then that record will not show.
    so when you delete the record in dbf side, you not only have to delete but also set this field to correct deleted value. then it will work both areas.

    better yet, do not delete any record at all. just achieve them by marking this to correct true value and run an operation to move the record to a different table like customer_archive for a customer table. that will give you access to historical data should you still need it and not worry about web side.

    in real life there should be no deletes just markers to say which are valuable and which are not except for very rare circumstances.
    Last edited by GGandhi; 10-13-2015 at 08:33 AM. Reason: spelling
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    ggandhi344@gmail.com
    Skype:ggandhi344@gmail.com
    1 914 924 5171

  13. #13
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,891

    Default Re: Populate UX from a List

    If you're working with a List control and dbf tables must be used then pack the table after a delete and sync. After the sync, run an Ajax Callback which packs the table.

    Code:
    function packTable as c (e as p)
    
    'debug(1)
    	
    dim tbl as P
        
    tbl = table.open("e:\program files (x86)\a5v12_3097\samples\alphasports\Customer.Dbf")
        
    tbl.pack() 
    tbl.close() 
    
    end function

Similar Threads

  1. Populate List through custom data source - Help
    By mikeallenbrown in forum Mobile & Browser Applications
    Replies: 4
    Last Post: 05-27-2015, 10:08 AM
  2. Dynamically populate fields into a list control
    By Peter.Greulich in forum Mobile & Browser Applications
    Replies: 7
    Last Post: 03-02-2015, 08:37 AM
  3. List Methods - Populate and Move Data
    By Laks007 in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 08-08-2014, 02:37 PM
  4. How to Populate List box from sql query results?
    By christobal in forum Alpha Five Version 8
    Replies: 0
    Last Post: 09-04-2007, 06:26 AM
  5. Auto Populate List Box
    By John Gamble in forum Alpha Five Version 5
    Replies: 7
    Last Post: 10-24-2002, 08:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •