Alpha Video Training
Results 1 to 13 of 13

Thread: Need help with data binding and primary key in UX

  1. #1
    Member Tbrondolo's Avatar
    Real Name
    Tom Brondolo
    Join Date
    Mar 2006
    Location
    New York,NY
    Posts
    477

    Default Need help with data binding and primary key in UX

    I have a UX bound to a SQL backend table that has two primary keys. On is an auto-increment record id and the other is a unique identifier. I want the UX to bind only to the unique identifier. I can achieve this in the UX by refreshing the bindings and then deleting the ID key and all works fine.

    But... every time I touch the UX it refreshes the primary keys and the CRUD does not work and I have to then go back and change the settings.

    Is there a way to force a primary key or to turn off the refresh?

    Thanks
    tom

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

    Default Re: Need help with data binding and primary key in UX

    I can't see a way to turn that stuff off. Can we look at this another way? What is it that you're doing that you need to ignore the auto increment key? Maybe there's another way to get it done without messing with the bindings?

  3. #3
    Member Tbrondolo's Avatar
    Real Name
    Tom Brondolo
    Join Date
    Mar 2006
    Location
    New York,NY
    Posts
    477

    Default Re: Need help with data binding and primary key in UX

    I'm populating a UX based on a call from an onclick event where the users selects a unique id. so the users picks id "PID0001" and the UX should populate on that id. I suppose I could do a SQL lookup to get the primary key id but that seemed like looking up the record twice. There is probably something I am missing on proper methodology but it just seem strange to give the ability to pick an alternate key and then have it keep changing back. I'm going to look at the javascript on loading primary keys and see if there is a method to set the key.

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

    Default Re: Need help with data binding and primary key in UX

    Just a bit more info, Tom.

    1. Are you using an Action to populate the UX? If so, which Action? Bound?
    2. Are there 2 components involved here? 1 - select the Key, 2 - the UX to populate? Or just 1 UX component?
    3. The user select a unique Id... from what? A Dropdown? A Grid? A UX? What's the source... not the same table as your two-part key table?

    I understand your problem. You're got one part of the key... the 2nd part (PID0001). You need to populate your UX, which is based based on the 2 part key, but you've only got one part of the key.

  5. #5
    Member Tbrondolo's Avatar
    Real Name
    Tom Brondolo
    Join Date
    Mar 2006
    Location
    New York,NY
    Posts
    477

    Default Re: Need help with data binding and primary key in UX

    Hi David,

    In one case I'm populating the key (pid0001) from a grid row. In the overide settings for opening the UX I assign this to a session variable. So component 1 has the PID0001 and I would like to use that in the data binding for the UX in component 2. The process works, but it's a pain to keep having to check that the data bindings did not change if I happen to open the UX in design mode.

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

    Default Re: Need help with data binding and primary key in UX

    Is the UX (component 2) data bound or unbound? Is the Grid bound to the same table that is populating the UX?

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

    Default Re: Need help with data binding and primary key in UX

    Tom,

    I don't think your last message got through... 7:11pm.

  8. #8
    Member
    Real Name
    Son H. Nguyen
    Join Date
    Sep 2013
    Posts
    50

    Default Re: Need help with data binding and primary key in UX

    hi everyone,

    I really need your advice about having couple of list controls and two or more sets UX controls bind to two different tables... (ei. customers table and employee table)... I can only bind UX controls to ONLY one selected table. Is there anyone got a way around this challenge??

  9. #9
    Member Tbrondolo's Avatar
    Real Name
    Tom Brondolo
    Join Date
    Mar 2006
    Location
    New York,NY
    Posts
    477

    Default Re: Need help with data binding and primary key in UX

    Are your tables linked? if so have you created relationships between tables?

    You can also just do the CRUD operations in an Ajax callback. Even though it is more programing it does give you more control.

    Tom

  10. #10
    Member
    Real Name
    Son H. Nguyen
    Join Date
    Sep 2013
    Posts
    50

    Default Re: Need help with data binding and primary key in UX

    I need to learn how to do the Ajax callback.. please provide me with proper link, or reference. I think I need to make a call from one UX component object to the next one.. for instance, one UX object will deal with the table "employees" and the other UX component will get its data binding from another table "customers".. etc.. and a third one that will tap into yet another table call "jobs" which has link to the customer table and the employee table and the service table. also, I could do programming with global functions using xbasic.. but I have not successfully able to call such a global function from one of the buttons on one of the UX compoments.. please help.. I am greatly and eagerly await for your advices.. Thank you in advance.. ps.. the table are not linked.. they are independent tables..

  11. #11
    Member Tbrondolo's Avatar
    Real Name
    Tom Brondolo
    Join Date
    Mar 2006
    Location
    New York,NY
    Posts
    477

    Default Re: Need help with data binding and primary key in UX

    Take a look through the video's on callbacks. I think Number 85 is a good one. There are lot's of examples of different types of callbacks so try that as a start.

  12. #12
    Member mixter's Avatar
    Real Name
    Michael Merlin
    Join Date
    Sep 2011
    Location
    Melbourne, Australia
    Posts
    220

    Default Re: Need help with data binding and primary key in UX

    Quote Originally Posted by Tbrondolo View Post
    every time I touch the UX it refreshes the primary keys and I have to then go back and change the settings.
    I had this problem too

    Table has autonumberID (which is not the primary key)

    and two other fields that are the primary key (employeeID and Date)

    But I wanted the UX bound to the autonumberID field

    In design mode, the UX kept changing the primary key from what I had set it to (autonumber) back to the primary key (employeeID, Date)

    The only way I found to make it stop doing this was create a SQL Server view of the same table.

    By using a View as the data source (instead of the table) the UX can no longer look see the real primary key, therefore the UX data binding never changes any more, it just stays exactly how I set it the first time.

  13. #13
    Member Tbrondolo's Avatar
    Real Name
    Tom Brondolo
    Join Date
    Mar 2006
    Location
    New York,NY
    Posts
    477

    Default Re: Need help with data binding and primary key in UX

    Hey thanks Mixter

    That was very helpful. It was a really annoying item that would create "bugs" every so often when I would forget to check the primary key settings.

    Tom

Similar Threads

  1. Primary Key Help
    By daddyz in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 11-01-2013, 07:58 AM
  2. Primary Key on SQL Server vs. Primary Key in AlphaDAO Connection
    By lsprowls in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 11-19-2011, 07:30 AM
  3. Primary Key
    By rolstra in forum Alpha Five Version 8
    Replies: 8
    Last Post: 03-04-2008, 05:52 PM
  4. Primary Key
    By jacklcs22 in forum Application Server Version 8
    Replies: 0
    Last Post: 07-09-2007, 02:47 AM
  5. Primary Key
    By jacklcs22 in forum Application Server Version 8
    Replies: 0
    Last Post: 06-23-2007, 04:00 AM

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
  •