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

Retrieving Power Search for Grid using dialog result to used in a dialog2 field

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

    Retrieving Power Search for Grid using dialog result to used in a dialog2 field

    Hi all,

    The application I am building needs the functionality of the Power Search for Grid using a Dialog Component FP, but it only allows me to search the grid and can not find a way to retrieve the search result from the grid to use in a field of the calling dialog.

    While at it, been having lots of problems with I/O between different component types, I understand the input side of arguments to a component, but are there any output arguments available from the called component that could be used by the caller component? That would probably solve my problem above and many others, need my nights and weekends back. If anyone out there has an IO map of Alpha components, what component to use, when and how to implement it. I beg of you, please share it.

    I really think that is the most basic piece of information needed by any programmer using any language or system, but some how after over a year working and studying the Alpha system it still eludes me. I have spent countless hours going through the documentation available, videos and this message board to no avail.

    Sorry to drift on and on about this, but my brain is burning out and I am not getting much farther. I/O map anyone!!!

    Thanks,
    Juancho...
    Juan Silva
    My Small Bizz, LLC
    sigpic

    #2
    Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

    What are you trying to accomplish? Could you use live-linking for the grid to the dialog to update the fields?
    Alpha Anywhere latest pre-release

    Comment


      #3
      Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

      Live link can link fields on the dialog to the grid, so the grid can accomplish some action based on the linked fields on the dialog, what I need is to search the grid and return several fields from the user selected row in the grid back to the dialog. My look up in being performed on a table which contains over 8 thousand records and the field being searched contains 256 characters, so I need to have a look up which includes all keywords for the same field.

      Regular grid search uses QBE which uses an "OR" expression and returns way too many records, so my customers would have to search on 2 to 3 passes in order to accomplish what I did with just 1 search using the Power Search FP, the problem is that I can not find how to send the selected record result back to the calling dialog executing the search.

      As can be seen in the attached, if my customers entered a few search keywords they would receive hundreds of records (750 in the case shown) to still research, if they went with a filter besides the search they could narrow to a few records, but that makes the system rely on several search steps, I need the system to be easy to use, can not complicate it or nobody will want to buy it.

      Thanks,
      Juancho...
      Attached Files
      Juan Silva
      My Small Bizz, LLC
      sigpic

      Comment


        #4
        Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

        Can you not just change the search type within the grid to wildcard? That effectively allows AND eg: *Beans*Black*

        Comment


          #5
          Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

          That would work if you knew in what order the keywords appeared in the field I am searching, by using the Power Search FP, well, it does not matter in what order the keywords appear in the field. I am searching the SR24 USDA ingredient descriptions database table, have no control of how the data will appear and can not expect customers to know.

          Checked the SQL using debug and the FP uses ("field-x like %black%" and "field-x like %beans%") and so on, while using the wildcard it be (field-x like %black%beans%).

          My database design uses complex relationships which need transactions and stored procedures to have a reliable database and since I want to deliver a consistent UI experience have decided to use dialog's in all data entry interfaces and grids for read only representations only. Thought the need to have data exchange between those component entities not only for this functionality but through the whole application.

          At times feel I made the wrong decision by using Alpha, but I am too deep invested in time and resources already, it is Alpha or BUST.

          Thanks,
          Juancho...
          Last edited by jmsilva; 07-04-2012, 07:04 AM.
          Juan Silva
          My Small Bizz, LLC
          sigpic

          Comment


            #6
            Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

            Do you just need the query results from the grid? Do you need the grid as well?

            You could certainly implement a function in the dialog and call it from the grid --- ajax callback or just a javascript function. I've done this with my dialog that utilizes the Power Search FP. I don't like splitting my code like that --- makes things HIDDEN. But I have a separate grid for my dialog that isn't used otherwise. You could also probably put the code in a file and reference that file in both places (.js, probably; or in an .AEX file.)

            Of course, if you're just after a better search filter, you could implement what your doing with Power Search FP in the search filter events for the grid. More work, but I imagine you get what you want in either situation.
            ---
            Sarah
            Alpha Anywhere latest pre-release

            Comment


              #7
              Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

              [QUOTE=jmsilva;615413]Hi all,

              The application I am building needs the functionality of the Power Search for Grid using a Dialog Component FP, but it only allows me to search the grid and can not find a way to retrieve the search result from the grid to use in a field of the calling dialog.
              QUOTE]

              I also would like to know the best method of using data from an embedded grid in the dialog fields.

              Thanks,

              MD

              Comment


                #8
                Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                Thank you Sarah, I just want to use the grid as a better search tool, once the search is completed and the selection data transferred to the dialog it will be hidden.

                Have no JS nor xbasic experience, trying to learn, restarting carrier in web development after having done COBOL for 35 years. Not very experienced in OO programming, but all books I have read always teach that objects have methods and they are invoked by the calling object using the arguments passed into then and that you would get back a response or none, it just seems like Alpha objects uses the latter and that makes it difficult for someone like me, who has always expected at least a success or failure response.

                My biggest obstacle with Alpha is how to move data from a called object back to the calling object, session variables seem to only work when you set then up at the beginning of the session and the value in then just stays there until the end of the session, tried changing then so the calling object would get its response, but that did not work (guessed that is why they are called session variables). Also tried arguments, but they seem to go only in one direction into the called object and never back.

                Maybe I am paraphrasing this the wrong way, have a button on the grid to select the appropriate row, need the button to set the value of fields on the calling dialog to values of the row selected by the user by pressing the button. Could you please share some of your code?

                Juancho...
                Last edited by jmsilva; 07-05-2012, 11:33 AM.
                Juan Silva
                My Small Bizz, LLC
                sigpic

                Comment


                  #9
                  Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                  Hi
                  I think what you are trying to do is fill in values into the dialog from a grid? If so, you just need to set the properties of a dialog field (say FoodName) as a look-up (I have this in a repeating section). You can set the lookup properties to open a grid with a search part. When you select an item from the grid you can map other grid fields to fill in the dialog fields. You dont need code for this.

                  I am using this to add ingredients in a recipe to a repeating section, after adding ingredients I call a stroed procedure to calculate various nutritional parameters in the dialog.

                  My problem, like you is the actual search method. I have settled on wildcard and found it quite effective in the SR 24 USDA database, though my clients will need a few lessons.

                  NB Base my grid in the USDA database just using the FoodName and Index and fill these into the dialog fields.

                  Comment


                    #10
                    Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                    Thank you Robin,

                    That is precisely what I am trying to do, but I already have done the lookup using a grid component with QBE and also wildcard, find it too cumbersome, in my case will not have personal contact with my customers, need to make the lookup as easy as possible. There has to be a way I can make the embedded grid populate a field on the parent dialog.
                    Juan Silva
                    My Small Bizz, LLC
                    sigpic

                    Comment


                      #11
                      Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                      Originally posted by jmsilva View Post
                      Maybe I am paraphrasing this the wrong way, have a button on the grid to select the appropriate row, need the button to set the value of fields on the calling dialog to values of the row selected by the user by pressing the button. Could you please share some of your code?
                      I will put something together tonight and post it for you. :)
                      Alpha Anywhere latest pre-release

                      Comment


                        #12
                        Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                        Thanks, here is what I been trying:

                        on the onclickevent of my grid button I added under text mode;

                        //get field value from grid
                        var LDESC = {grid.object}.getValue('G','LONG_DESC',{grid.rowNumber});

                        //get pointer to parent
                        var po = {grid.object}.getParentObject();

                        //set value of field in parent
                        if(po) po.setValue('ingredient',LDESC);

                        //alert popup's for debugging
                        window.alert(LDESC);
                        window.alert(po);


                        LDESC field from the grid is displaying correctly, but po is returning false, could it be that since the grid is embedded? maybe it is not considered a parent object?

                        Confirmed, modified another dialog to open the grid with this code directly and the data was retrieved, po was true and the field in the dialog was populated with the selected grid row data selected. The question remains then, how can we accomplish the same result when the grid is embedded???

                        Any ideas anyone?
                        Last edited by jmsilva; 07-06-2012, 06:47 AM.
                        Juan Silva
                        My Small Bizz, LLC
                        sigpic

                        Comment


                          #13
                          Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                          Juancho,

                          I had the same problem and I spent the day searching the forums and I think I found the answer. Here's the link to the thread.

                          Try This
                          //get field value from embedded grid from a dialog
                          var LDESC = {dialog.EmbeddedGrid_GRIDNAME}.getValue('G',FIELD',{grid.rowNumber});

                          Mike

                          Comment


                            #14
                            Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                            Got a working solution...

                            Works for both dialog and grid parents, just replace grid for dialog on the code... levels need not be concerned, in my case dialog, opening dialog with embedded grid.

                            on the on-click add an inline-javascript of the parent dialog or grid, just like in video D37
                            Code:
                            var obj = {id: '{dialog.object}', row: '{dialog.RowNumber}' }; // reference to parent dialog
                            window['__pd'] = obj;
                            on the embedded grid, onclick event (button/row/whatever)
                            Code:
                            var parentDialog = window['__pd'];
                            
                            if (typeof parentDialog != 'undefined')
                            	{
                            		var parentDialogAlias = window['__pd'].id;
                            		var parentObj = window[parentDialogAlias];
                            		var row = window['__pd'].row;
                            		parentObj.setValue('ingredient:row',{grid.object}.getValue('G','LONG_DESC',{grid.rowNumber}));
                            		parentObj.setValue('fdgrp_cd:row',{grid.object}.getValue('G','FDGRP_CD',{grid.rowNumber}));
                            		parentObj.setValue('food_group:row',{grid.object}.getValue('G','FDGRP_DESC',{grid.rowNumber}));
                            		parentObj.setValue('ndb_no:row',{grid.object}.getValue('G','NDB_NO',{grid.rowNumber}));
                            	}
                            Here I am setting the value in the parent dialog from a child grid, but you could also be getting the values from the parent and setting then on the child. Same would work for any available methods.

                            Like to thank all that help me down this rocky learning road, it was worth it... Juancho
                            Juan Silva
                            My Small Bizz, LLC
                            sigpic

                            Comment


                              #15
                              Re: Retrieving Power Search for Grid using dialog result to used in a dialog2 field

                              Originally posted by jmsilva View Post
                              Got a working solution...

                              Works for both dialog and grid parents, just replace grid for dialog on the code... levels need not be concerned, in my case dialog, opening dialog with embedded grid.

                              on the on-click add an inline-javascript of the parent dialog or grid, just like in video D37
                              Code:
                              var obj = {id: '{dialog.object}', row: '{dialog.RowNumber}' }; // reference to parent dialog
                              window['__pd'] = obj;
                              on the embedded grid, onclick event (button/row/whatever)
                              Code:
                              var parentDialog = window['__pd'];
                              
                              if (typeof parentDialog != 'undefined')
                              	{
                              		var parentDialogAlias = window['__pd'].id;
                              		var parentObj = window[parentDialogAlias];
                              		var row = window['__pd'].row;
                              		parentObj.setValue('ingredient:row',{grid.object}.getValue('G','LONG_DESC',{grid.rowNumber}));
                              		parentObj.setValue('fdgrp_cd:row',{grid.object}.getValue('G','FDGRP_CD',{grid.rowNumber}));
                              		parentObj.setValue('food_group:row',{grid.object}.getValue('G','FDGRP_DESC',{grid.rowNumber}));
                              		parentObj.setValue('ndb_no:row',{grid.object}.getValue('G','NDB_NO',{grid.rowNumber}));
                              	}
                              Here I am setting the value in the parent dialog from a child grid, but you could also be getting the values from the parent and setting then on the child. Same would work for any available methods.

                              Like to thank all that help me down this rocky learning road, it was worth it... Juancho
                              Whoa. Time got away from me!

                              I just wanted to share that you can check to see if a function exists in javascript before you call it. I have a situation where I display multiple linked grids in a regular grid. When editing content in one linked grid, it's a possibility that changes to the content will result in that entry appearing in a different linked grid. While I have defined that the grid should be refreshed when the content is modified, the refresh doesn't propagate all the way up the stack --- I just refreshes the single linked grid. So I needed to somehow refresh the parent grid of the child grid that needs to be updated after calling some other grid that provides all the editing (3 grids deep!)

                              Code:
                              if (eval('typeof refreshOtherGrids == \'function\'')) {
                              	eval('refreshOtherGrids()');
                              }
                              In the above, I checked to see if the function is defined (and is actually a function). If it is, then I call it. I have to wrap the function call itself in eval to avoid complaints of the form "this isn't defined! Error!" when the file was parsed by the browser/alpha five.

                              In my grid where I actually need to do the updating, I define refreshOtherGrids:

                              Code:
                              function refreshOtherGrids()
                              {
                                  {grid.Object}.refresh();
                              }
                              This is a pretty simple example. There are other ways to accomplish the same thing --- custom events & event handlers, defining a variable in window (like you did!), bugging Alpha Five with feature requests, etc.

                              Good luck with your project!

                              ---
                              Sarah Mitchell
                              Alpha Anywhere latest pre-release

                              Comment

                              Working...
                              X