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

Embedded Grid: need help with syntax to assign grid field value to a global variable

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

    Embedded Grid: need help with syntax to assign grid field value to a global variable

    I have been spinning my wheels on and off for a total of 20 hours trying to assign a value in the current row of an embedded grid into a global variable. However, the syntax escapes me. Please help if you can. I have reached the point of spontaneous combustion. Following are the details:

    1. Form 'F' has Grid 'G' embedded within and displays the records from Table 'T'.
    2. Form 'F' initializes Global Variable 'GV' when opened and assign a character value of "".
    3. I would like to attach an event on the 'on row select' event found under system events of the grids properties that will return the value of one of the fields from the row just selected and assign it to 'GV'.
    4. By doing so, my 'G' is functioning as a record selector that the other objects of 'F' can use to do their thing.
    5. I tried using Action Javascript 'AJ', client side x-basic 'csxb', and a combination of the 2 and can not get a value passed to the variable.

    Where am I going wrong? Does anyone know the correct syntax and placement to accomplish this? I searched high and low on the message boards and could not find any questions that came close. I also tried several of the how-to's and other instructional's that I came across but they did not work either.

    Any help is greatly appreciated.
    Thanks,
    James

    #2
    Re: Embedded Grid: need help with syntax to assign grid field value to a global vari

    I do not use the embedded grid. That said, does it have an onclick event? If so try using AS do a set variable = field value.
    -----------------------------------------------
    Regards
    Mark Pearson
    [email protected]
    Youtube channel
    Website

    Comment


      #3
      Re: Embedded Grid: need help with syntax to assign grid field value to a global vari

      Clunes, thanks for the quick response. Yes I did try that syntax using around a dozen different flavors. The ones that stick out that did not work in the Action Javascript were:

      Code:
      var a = global v (where var a = {grid.object}.getValue('G','LASTNAME',{grid.rowNumber});
      SESSION.a = global v (where SESSION.A was listed as a published session variable)
      self->a = global v
      etc....
      Thanks,
      James

      Comment


        #4
        Re: Embedded Grid: need help with syntax to assign grid field value to a global vari

        Originally posted by jhackney View Post
        I have been spinning my wheels on and off for a total of 20 hours trying to assign a value in the current row of an embedded grid into a global variable. However, the syntax escapes me.
        You want to:
        1. read the value of a field in the grid
        2. assign that value to a JS var
        3. Read the JS var into a global var

        Check out this thread:

        http://msgboard.alphasoftware.com/al...ad.php?t=92797
        Peter
        AlphaBase Solutions, LLC

        [email protected]
        https://www.alphabasesolutions.com


        Comment


          #5
          Re: Embedded Grid: need help with syntax to assign grid field value to a global vari

          Peter, that did the trick. Thanks a million for the help. It is very appreciated. My circumstances were a little different that what was referenced so I will detail what I did for the community.
          1. I dimmed a global var called "my_global_var" inside a form when initialized. Since the variable was called prior to the initialization of the grid, it is accessible by the grid. Otherwise, I could have dimmed it inside the grid itself.
          2. Inside the grid, I defined a calculated field called "my_calc_field" that uses one or several other fields to calculate it's value.
          The goal of my form is to be able to select a row of data in the grid and use that information to either populate other fields outside of the grid on the form or to use that information as a trigger to display other related information in the form.

          As such, the appropriate event for me was "onRowSelect". Unlike the example provided to me, this event is located under the "Properties" section of the grid under "Javascript System Events". Under this event I have the following javascript:

          Code:
          var rowNum = {grid.object}._selectedRow;
          {grid.Object}.ajaxCallback('G',rowNum,'xbGet_JS_Var','','_getData=true');
          Note that I used the same function name that Peter used in his example. Also note that I had to add the first line of javascript b/c the "onRowSelect" event is not an event defined in each row as was the original example. Thirdly, I had to add the "_getData=true" to the end of the second line because my grid is read only. As such, the ajax callback would not return the values for ALL fields in the row unless I added this javascript.

          Under the definition of the "xbGet_JS_Var" function, I have the following code listed in the "X-Basic Function Declaration" section of the grid:
          Code:
          function xbGet_JS_Var as c (e as p)
              
          ''get the JavaScript variable from the hidden calc field
          [COLOR=Blue]my_global_var[/COLOR] = e._currentRowDataNew.[COLOR=Blue]my_calc_field[/COLOR]
          
          end function
          Now, whenever I select a row in the grid, the value in my_calc_field is populated inside a global variable that I can use anywhere else on the form.
          Thanks,
          James

          Comment


            #6
            Re: Embedded Grid: need help with syntax to assign grid field value to a global vari

            Helped me a lot, thanks

            Comment

            Working...
            X