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

Calling a grid from a grid

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

  • Calling a grid from a grid

    Alpha 5 v10.5 Hope I've got the right place to post.

    I have a table of products that are in a grid (it displays fine)
    Within each record(row) there is a field that holds a (form name) that needs to be displayed (either by a button or hyperlink)
    Here's the senario of what needs to happen.....

    When the main grid is displayed, I can click on the row or button for that row and it should popup another grid with the form name.
    If I have 5 different forms (each with a different name) and the detail row has one form name in a field, when the button is
    pressed, it should use the formname to call that grid for that particular form.

    I've tried using a button, but in the javascript when I have to select a grid, I can't seem to override the grid name.....
    grid.componentname=Form1 I've tried an argument but it only gives me Form1 with the form name filled in, not getting the new form.

    I'm not sure if this makes sense, but it seems to be simple enough, I just am too green to figure it out. I've been through 1/2 day of videos
    and have missed something.

    Anyone out there care to help me out?

    thanks, Jim

  • #2
    Re: Calling a grid from a grid

    If you create action JS to open a specific grid, and right-click on the action and select "view javascript", and then click on the "declaration global" tab, you will see JS code like this:

    Code:
    window['{grid.componentName}_G__UNBOUND_HYPERLINK_1_1'] = function(rowNum,rowId,objEle) {
    
    var windowName = 'WINDOW_07b8b8f4_c48d_4b98_bc97_fd700be8541d';
    var currWindow = {Grid.object}.getWindow(windowName);
    
    var go = new Object();
    go.objectId = objEle.id;
    go.gridName = 'BILL_TimexTotals';
    go.alias = '{Grid.componentname}_BILL_Timex_args';
    go.submitCurrentFieldValues = true;
    go.sourceGridPart = 'G';
    go.sourceGridRowNumber = rowNum;
    go.workingMessage = '<img src=\'CSS/A5System/images/wait.gif\' />Working...';
    go.userFilter = '';
    go.baseFilter = '(Project_id = `[[[data.Project_id]]]`  )  .and. (Total <> 0  )';
    go.arguments = '';
    go.linkDefinition = '';
    go.placeHolderValues = 'Project_id =' +{Grid.object}._getValue('G','PROJECT_ID',go.sourceGridRowNumber);
    go.userOrder = '';
    go._thisGridAlias = {grid.object}.gridId;
    
    go._gridCurrentFilter = {grid.object}._gridFilter;
    go._gridCurrentOrder = {grid.object}._gridOrder;
    go._gridCurrentArguments = {grid.object}._gridArguments;
    go._gridCurrentDBType = {grid.object}._gridDBType;
    
    go.overrideSettings = '';
    go.a5_default_path = '{grid.defaultPath}';
    
    go.flagTimer = 'F';
    go.flagQueryEcho = 'F';
    go.flagDebugMode = 'F';
    go.windowName = windowName;
    
    
    
    
    if(!currWindow) {
    	currWindow = {Grid.object}.createWindow(windowName,'modal-resizable',
    	{body: {content: {type: 'blank',
    elementId: '~'}},
    height: '',
    width: '',
    title: {html: '+'}}
    	);		
    	go.gridDiv = currWindow.getWindowId('body');
    	{grid.Object}.openChildGrid(go);
    	currWindow.show('2in','2in');
    
    } else {
    
    	ele = '{Grid.componentname}_BILL_Timex_args.GRID_PART.FORM_CONTAINER_DIV';
    	pele = $(ele);
    	pele.innerHTML = '<img src=\'CSS/A5System/images/wait.gif\' /> Working...';
    	go.gridDiv = currWindow.getWindowId('body');
    	go.parentGridId = '{grid.componentname}';
    	window['{GRID.COMPONENTNAME}_BILL_TIMEX_ARGS_GridObj'].synchronizeGrid(go); 
    	currWindow.setPosition('2in','2in');
    	
    	
    	
    };
    
    
    
    
    }
    You can try modifying that code as needed to read & load your form name. Have never done that exactly, but I'm sure it's doable.
    Peter
    AlphaBase Solutions, LLC

    Peter@AlphaBaseSolutions.com
    https://www.alphabasesolutions.com


    Comment


    • #3
      Re: Calling a grid from a grid

      If I understand right you want to open from grid1 another grid2. The selection value comes from a field value in grid1.

      If so you can use lookup with linked grid (video #8). You have to create 5 (5 forms) extra grids holding actual grid name and use this extra grid as a primary lookup grid with grid1 (and then select the right one). With this technique you don't have to write any code.

      Comment


      • #4
        Re: Calling a grid from a grid

        Thanks Peter. I tried to modify the code, but all I can do is close the window after modifying the code.
        I'm not sure where to put the new code. I did put 2 lines in Override Settings {Grid.ComponentName}=":WhatGrid"
        All I get is the original grid with the ID filled in from the :WhatGrid argument.

        Still working at it.

        Comment


        • #5
          Re: Calling a grid from a grid

          {Grid.ComponentName}=":WhatGrid"

          That's not going to work. You're mixing xbasic with JS. You need to get the field value using

          {grid.Object}.getValue(part,name,[row - omit for Search and Detail View part])

          and probably evaluate it using JS.
          Peter
          AlphaBase Solutions, LLC

          Peter@AlphaBaseSolutions.com
          https://www.alphabasesolutions.com


          Comment


          • #6
            Re: Calling a grid from a grid

            Originally posted by kkfin View Post
            If I understand right you want to open from grid1 another grid2. The selection value comes from a field value in grid1.

            If so you can use lookup with linked grid (video #8). You have to create 5 (5 forms) extra grids holding actual grid name and use this extra grid as a primary lookup grid with grid1 (and then select the right one). With this technique you don't have to write any code.


            Thanks Ken, that's kinda where I'm at now. I created a new grid with 25 buttons on it. Each calls the correct grid but that is a work-around until I get this figured out. Not sure which video #8, but I've tried linking the grid also.

            Thanks guys, I'll keep poking around and trying different things to get this worked out.
            Jim

            Comment


            • #7
              Re: Calling a grid from a grid

              Jim,

              I must have been having a stupid attack. Instead of messing around with that intricate JS that A5 generates, do this:

              On your hyperlink or button put in Action JS in the OnClick event. For each grid, create one action. So if you have 25 potential grids to open, you'll have 25 Action JS "Open Grid" rows. Then insert before the first row and between each and every grid row an InLine Action JS. The first Inline will have this:

              //get a field value
              vGrid = {grid.Object}._getValue('D','SOME_FIELD');

              //JavaScript case function
              switch (vGrid)
              {
              case 'Grid1':


              Then you will have the first Action JS to open "Grid1"

              Then the next Inline is:

              break;
              case 'Grid2':

              And the next first Action JS to open "Grid2"

              Then the next Inline is:

              break;
              case 'Grid2':


              and so on...

              The last inline at the very end after the last Gird is:

              }


              If you were to convert the whole thing to text or "view JS", you get something like this:

              Code:
              //get a field value
              vGrid = {grid.Object}._getValue('D','SOME_FIELD');
              
              switch (vGrid)
              {
              case 'Grid1':
               {grid.componentName}_G__UNBOUND_HYPERLINK_1_1({grid.rownumber},'{grid.rowId}',this);
                break;
              case 'Grid2':
                 {grid.componentName}_G__UNBOUND_HYPERLINK_1_2({grid.rownumber},'{grid.rowId}',this);
                break;
              case 'Grid3':
               {grid.componentName}_G__UNBOUND_HYPERLINK_1_3({grid.rownumber},'{grid.rowId}',this);
                break;
              case 'Grid4':
                {grid.componentName}_G__UNBOUND_HYPERLINK_1_4({grid.rownumber},'{grid.rowId}',this);
                break;
              default:
                {grid.componentName}_G__UNBOUND_HYPERLINK_1_4({grid.rownumber},'{grid.rowId}',this);
                //or whatever...
              }
              The reason not to convert the whole thing to text is so if you need to change a grid opening setting.

              This method works well and this technique can be used for other things such as selecting a report, etc.
              Peter
              AlphaBase Solutions, LLC

              Peter@AlphaBaseSolutions.com
              https://www.alphabasesolutions.com


              Comment


              • #8
                Re: Calling a grid from a grid

                OK, Peter....Thanks. I'll give this a try and let you know how it turns out.
                Jim

                Comment


                • #9
                  Re: Calling a grid from a grid

                  Peter, I tried setting up 3 grids with the information. I've attached a Word doc to show my process. I hope it makes sense or
                  I've done something wrong....let me know. I'm not sure if the document attached, if not email me at: txjfkf@gmail.com


                  thanks for the help,
                  Jim
                  Attached Files

                  Comment


                  • #10
                    Re: Calling a grid from a grid

                    The doc you attached only contains my post.
                    Peter
                    AlphaBase Solutions, LLC

                    Peter@AlphaBaseSolutions.com
                    https://www.alphabasesolutions.com


                    Comment


                    • #11
                      Re: Calling a grid from a grid

                      Multi-Grid.docMulti-Grid.doc

                      Peter, I'll try to insert the document again. Not sure what I'm doing wrong.

                      Comment


                      • #12
                        Re: Calling a grid from a grid

                        Multi-Grid Display.doc

                        Comment


                        • #13
                          Re: Calling a grid from a grid

                          Peter, maybe the last Doc did it.

                          Multi-Grid Display

                          Comment


                          • #14
                            Re: Calling a grid from a grid

                            I see the problem. Your case statement is using my example ...

                            case 'Grid1':


                            case 'Grid2':


                            case 'Grid3':


                            'Grid1' etc needs to be the name of the corresponding grid that the next line opens up. If a field "grid" value is Aciphex, then the statement should read

                            case 'Aciphex':

                            etc etc.

                            Also make sure you close with a } not a { as you show in your document.

                            Yeah, no need to use a filter.
                            Peter
                            AlphaBase Solutions, LLC

                            Peter@AlphaBaseSolutions.com
                            https://www.alphabasesolutions.com


                            Comment


                            • #15
                              Re: Calling a grid from a grid

                              Thanks Peter,
                              I made the corrections and that gets me closer....but it seems to run a cycle behind;

                              first time in - I press the button and nothing
                              next click - Aciphex form is displayed.
                              move to Acyclovir and click - the Aciphex form displays
                              click agian - the acyclovir form displays
                              move to alesse and click - acyclovir form displays
                              click again - alesse form displays


                              I have this in the onClick event, but it seems to be getting the form name from last viewed, if that makes sense.
                              I tried changing from 'D' to 'G' in vGrid = {grid.Object}._getValue('D','NOTE_TO_BUYER'); but that didn't work
                              either.

                              Am I missing a response or a function that should happen first?

                              thanks for the help,
                              Jim

                              Comment

                              Working...
                              X