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

How do I access the return value from a list control for an embedded object

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

    How do I access the return value from a list control for an embedded object

    Appreciate some commentary to understand if I am on the right track...

    I have a mobile app, within it is a list control on one of the panels which displays a bunch of tasks, within the 'list item' is a Task_ID field (GUID) which is also a primary key, I have configured this as the return value in the data source tab of the list builder.

    Q1. The primary UX component has data bindings for the controls I initially established for the initial purpose of the component. I later decided there was more info I wanted to capture and submit to the DB, within the app, but I couldn't figure out how to tie the new controls I built within a new panel and submit them as I had 'used up' the afterValidateServerSide event for the initial controls. Am I right in thinking I need to create a new UX (User eXperience-took me ages to find this out) with its own bindings and embed this within the initial UX so it appears seemless and integrated? i.e. is this how you get multiple data submit capability for unrelated data within one mobile app (sorry if this sounds confused...I am)

    On the basis that my assumptions of Q1 are correct, my next question is as follows:

    Q2. In an embedded UX component (within the primary UX component) I need to populate the default value of a control with the return value of an item selected (the Task_ID) in the original list control...how do I access this? I can 'grab' session values by setting the default property of a text control to e.g. =session.User_ID where I create this session value at login through an a5 script on the login page but I cant figure out how to grab the return value of the list control on e.g. panel A after clicking it and putting this into a control on an embedded UX on e.g. panel 2, I'm not even sure if this can be done, perhaps I need to store the TASK_ID from the list control into a state variable when I click it and access the state variable from the embedded UX??

    #2
    Re: How do I access the return value from a list control for an embedded object

    Q1 sounds about right. If you have unrelated data you want to submit, making a new UX with it's own data bindings to another table should work fine


    when you embed the new UX, there is a "Link" property on the embedded object properties on the parent,
    that you can pass your primary key from the parent to the embedded UX

    ====

    However you don't necessarily need data binding

    You could consider using an unbound UX, which populates itself and submits data to the right table

    one way to handle Q2 is grab the Task_ID value from your original List control, as the embedded "new UX" loads

    e.g. in the new UX
    Client Side Events
    onInitializeComplete or onRenderComplete

    an example:

    Code:
    	var objEmpTimeSheet = {dialog.object}.getParentObject();
    	var iDS = objEmpTimeSheet.getValue("iDaySheet"); 
    	{dialog.object}.setValue("iDaySheetID",iDS);
            {dialog.object}.runAction('PopulateUX');
    the last line uses Action Javascript as per image attached, the key being "Populate controls in an UNBOUND UX component..."

    PopulateUnboundUX.png


    and in the properties window of that Action Javascript method,

    the "Controls to read Primary Key Value From" property is set to the value of "iDaySheetID" from the third line above

    roughly speaking, my iDaySheet text control on the parent (UX that calls the "new UX") is equivalent to your Task_ID list control


    as the embedded "new UX" loads it grabs the value of that key ID from the parent (UX) that contains the embedded object "new UX"
    and stores the key value in a variable called iDS
    and then copies the value into a control on the new UX named iDaySheetID
    and then populates the unbound UX


    Here's another example, using onInitializeComplete
    where the "new UX" is grabbing an ID from the grid component that opened the "new UX"
    this is more for a popup window being called from a grid
    however embedded UX uses getParentObject similarly to a popup UX
    Code:
        var objTripGrid = {dialog.object}.getParentObject();
        var RN = objTripGrid.getSelectedRow();  //rownumber
        var iDS = objTripGrid.getValue("G","iDaySheet",RN); 
        {dialog.object}.setValue("iDaySheetID",iDS);
        {dialog.object}.runAction('PopulateUX');

    You can also use Server Side event OnDialogInitialize to do stuff

    e.g. set State variables (that the client side can also see and use)
    Last edited by mixter; 07-23-2014, 09:57 PM.

    Comment


      #3
      Re: How do I access the return value from a list control for an embedded object

      Hi Michael, thanks for your reply and the detail within it. Re Q1 thanks for letting me know I'm on the right track

      Re Q2 I have been banging my head for a couple of hours trying to follow your advice but I'm not getting anywhere

      when you embed the new UX, there is a "Link" property on the embedded object properties on the parent,
      that you can pass your primary key from the parent to the embedded UX
      I can't even find this link property in the embedded object properties on the parent (I assume I am looking in the right place)

      embeddedObjectProperties.PNG

      This is what the embedded UX object looks like in the host UX (in case you can see I've done anything stupid)
      hostUX.PNG

      The embedded UX is within a Panel Layout...I don't think that's creating an issue, I tried creating an embedded UX not in a Panel Layout and still had the same issues.

      So then I tried the code you suggested (onRenderComplete) to get a pointer to the parent object, invoke the getValue method to grab my Task_ID value and then set this in the field in my child component using {dialog.object}.setValue() but I can't get this to work either. I put an alert into this code and noted it ran as soon as the host UX ran. That confused me as I expected this code to run when the embedded panel rendered...otherwise how would it know what to 'grab'?

      I noted rereading my post that I had omitted one piece of info from my first post that may (or may not) be relevant. When I click the list (I call Task_WIP, this sits in a panel called Task_List_Detail) it has a detail view (this panel card is called Task_List_Detail_View) which is another UX that I mapped fields for from the parent Task_WIP list (And it works great). It's on this UX panel (the detail view) where the field value I want is and where I have a button that opens the embedded UX.

      1) Click the list, this opens up the detail view
      2) Click the button on the detail view and open up the embedded UX (grab the value of Task_ID in the detail view and stuff it into the Task_ID field in the embedded grid)

      So where my thinking is now is that it looks like the embedded UX is rendering at the same time the host UX renders and if this is true then the code cant work because I have not had a chance to select the item on the list which has the Task_ID I need that then copies through to the detail view.

      I then noted a property on the Embedded Object property sheet (I'm still within the host UX) under the "In Panel Card Properties" that says "Delay Render till visible" I thought this might be the answer but I cant get anywhere with this either, if I check it, my embedded UX just gets stuck (shows working but nothing happens). Closer inspection shows that this property assumes the card is within a panel navigator, mine wasn't, so I changed it so it was but it still wont work.

      Not sure if any of this makes sense, I've lost half my Sunday trying to figure it out and I'm now going to have a beer. If you can think of anything that might point me the right direction it would be really appreciated, thanks again.

      ...one question I did mean to ask (which is hopefully simple) when you create the pointer to the parent object, where the parent object is a list and you have clicked a list item does this mean the list item is now an object aka the parent object not the list (as I am/was assuming)?

      Comment


        #4
        Re: How do I access the return value from a list control for an embedded object

        ok dokey...so to get this to work I used Michael's code (thanks again Michael I couldn't have done this without your input) there were two key points I discovered on top:

        1) I ended up using the onPanelActivate client side event handler (not the onInitialiseComplete or onRenderComplete) in the embedded UX, it appears this one is purpose built for embedded components in panels?

        2) I needed to put my embedded UX into its own panel, previously I had as one of two panels that were nested in a panel layout. Within the panel layout I could not get Michaels code to fire (I tested this by putting a javascript alert('hello'); statement in Michaels code to figure out if it was working; it finally did when the UX was in it's own panel.

        Thanks again Michael, it's guys like you that take the time to help us non-programmer types out that keep us moving forward enthusiastically, when all hope seems lost :)

        Comment


          #5
          Re: How do I access the return value from a list control for an embedded object

          Q1. The primary UX component has data bindings for the controls I initially established for the initial purpose of the component. I later decided there was more info I wanted to capture and submit to the DB, within the app, but I couldn't figure out how to tie the new controls I built within a new panel and submit them as I had 'used up' the afterValidateServerSide event for the initial controls. Am I right in thinking I need to create a new UX (User eXperience-took me ages to find this out) with its own bindings and embed this within the initial UX so it appears seemless and integrated? i.e. is this how you get multiple data submit capability for unrelated data within one mobile app
          it is good to know you solved the problem and I am also happy for you. but may I ask a fundamental question, just for curiosity.
          you have few controls in your dialog that go to table a and you have added another field in the original dialog that will update table b ( somehow they are not related as you said 'unrelated table' in the question).
          regardless, the logic will be table a must update successfully then only table b should update, I think. right?
          if the answer is yes then
          you do not need to embed any panels just leave the original dialog as it is with as many new fields you have added, just add a code in the dialog submit action scripting that will update if the table save goes successful only.
          again I am just asking to clear out in my mind, some fundamental principles. not to jeopardize your current dialog style.
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


            #6
            Re: How do I access the return value from a list control for an embedded object

            Hi Gandhi, interesting question. Re-reading my post my choice of words (i.e. ...unrelated...) was probably poor in context to the issue. I struggle explaining my issues sometimes and can get lost in a technical detail.

            Table "A" stores "tasks". Table "B" stores comments related to "tasks" in table A.

            What I was doing was viewing a list of tasks in a list control (that was read off table A). Then when I clicked on a list item I transitioned to a detail view of the task that showed more info and also acted as a "landing page" (aka Panel A) that the user can spring off to do other things related to the task (e.g. edit some of the Task details, view comments related to the task, view related sub tasks etc...). With regards to viewing the comments related to a task this panel (Panel B) contained another list component that read related comments.

            I needed the functionality to add a new comment. This is where I got stuck for about 6 hours.

            Initially I tried to configure Panel B using a panel layout to show both the list of comments and at the bottom have another small panel (Panel C) where the user could enter comments and save (there were also a bunch of hidden fields which contained the user ID, current date etc...in Panel C) but this is where I came unstuck (as per above, I could not get Michaels code to fire. I eventually changed the design and put a button in the header of Panel B (list control for the comments) and used this to open Panel C independently , now Michaels code can fire. I can pull through the TASK_ID from Panel B (incidentally this value was automatically pulled through from Panel A when Panel B was made a detail view of the list on Panel A) and stuff it into Panel C (into a hidden control), create my comment and save the record to the comment table (using the Task_ID value to populate the Task_ID field in my comments table which is a FK to the Task table).

            So (and I'm sorry for the long explanation) in answer to your question

            the logic will be table a must update successfully then only table b should update, I think. right?
            Table A does not have to be updated successfully and then only table B should updated. I needed to update table B independently of Table A so in my mind they were 'unrelated' however they are related in the database where Table B is a child to Table A where the PK of Table A (Task_ID) is the FK of Table B.

            Hope that make sense, thanks for jumping in Gandhi I'm a fan :)

            Comment


              #7
              Re: How do I access the return value from a list control for an embedded object

              Good, it does make sense.
              Glad to hear from you. Appreciate your feed back.
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment

              Working...
              X