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



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

Session variable from a list control

  • Filter
  • Time
  • Show
Clear All
new posts

  • Session variable from a list control

    I'm trying to set a session variable when a button is clicked on in a List control. I've created the Javascript Action and went to the Set Session Variables section. The examples are provided for a grid or a dialog, but not for a list. What would be the code for setting a session variable with the name CustomerID from the value in the field CUSTOMER_ID?

    You can see this in the attached image.Screen Shot 2016-08-10 at 10.59.35 AM.png

  • #2
    Re: Session variable from a list control

    Under List Control System Events\onSelect

    You need to create an ajax Callback.


    • #3
      Re: Session variable from a list control

      Pass your CUSTOMER_ID to an xbasic function and set the session variable there.

      in your list's onSelect...
      var cID = this.selectionData[0].CUSTOMER_ID;

      Your xBasic function...
      function SetSessionVars as c (e as p)
      session.customer_id = e.__CID
      end function
      EDIT: ooppss...your clicking a button in that list. No problem. In that button's onClick (instead of the list's onSelect) you'll need this...

      var lObj = {dialog.object}.getControl('Your_List_Name');
      var cID = lObj.selectionData[0].CUSTOMER_ID;
      Last edited by mikeallenbrown; 08-10-2016, 03:46 PM.
      Mike Brown - Contact Me
      Programmatic Technologies, LLC
      Independent Developer & Consultant


      • #4
        Re: Session variable from a list control

        Are you sure you want/need to set a session variable? Overall, what are you doing? Why the need for a session var?


        • #5
          Re: Session variable from a list control

          That is a good question, David. I should have asked that since I only use session variables for older components. I very rarely use them in the newer components and usually only to stay compatible with the older components.


          • #6
            Re: Session variable from a list control

            The list control is listing the Customers. The button opens a UX with the customer information from a single table. There's another list control in that UX that lists that particular customer's orders. I'm just trying to filter that list to show only that customer's orders. Figure if I pass the CustomerID, I can use session.CustomerID to filter anything related. Is there a better way now?


            • #7
              Re: Session variable from a list control

              Use arguments.


              • #8
                Re: Session variable from a list control

                Ok... you don't need to use Session vars. You've got the info you need in the Customers List. Are you returning the CusotmerID from the Customers List? If so, open the Customer Orders List, and click on the builder for Arguments. Arguments are global to the UX, so you can get to Arguments from the UX Properties as well.

                Add an Argument and set the property "Get Argument value from" to "Set Value at Run-time"... and then select the Customers List as the "Value".

                You could also set up your Customer Orders List to have a Parent List. That's in the Data Source tab of your Customer Orders List.


                • #9
                  Re: Session variable from a list control

                  So I would set the filter in the Client-side Filter/Order, and Grouping?

                  How do I specify the argument once it's created? say the argument I created was 'custid'


                  • #10
                    Re: Session variable from a list control

                    And I don't think the parent list filter works. They are not on the same UX. The 'orders' list is in a UX opened from the 'customers' list.


                    • #11
                      Re: Session variable from a list control

                      And I understand how the argument is created. Just not sure the exact code to do the filtering.


                      • #12
                        Re: Session variable from a list control

                        I think I understand now... that your Customers List is a UX... and you're opening a 2nd UX to show the Customer Information for the Customer selected... and the 2nd UX also contains a Customer Orders List.

                        If this be the case then your Argument will point to the CustomerID control to get it's value. And... your Customer Orders filter would be something like CustomerId=:custid if the Customer Orders List contained the field CustomerId.

                        The filter would be set in one of 2 places... but not usually Client-side Filter/Order, and Grouping.

                        If the List Data Source tab property Method for defining SQL Query is set to Fields from a Table, then you'll have a Filter property to work with... and a builder to use if you wish.

                        If the List Data Source tab property Method for defining SQL Query is set to Custom, then you'll be working with a SQL Query... usually a SELECT statement... where you'll define a WHERE clause and use the same format... CustomerId=:custid
                        Last edited by Davidk; 08-10-2016, 07:02 PM.


                        • #13
                          Re: Session variable from a list control

                          Thanks David. Got all that but setting the argument. When I go to set the argument, I set the Value to the list name which is {customers}. correct? I want to use the Customer_ID field in that list as my argument. How do I get that part out? I can set the actual value of one of the customer's ID's and all filters great, but can't seem to get it right to pull one with the list argument.

                          And yes, I've got the filter in the SQL Custom Query. That's all good.


                          • #14
                            Re: Session variable from a list control

                            Since you're Customers List is on a different UX, you can't use that in your Argument.

                            In your 2nd UX, you're showing Customer Information... right? And one of the Controls in the 2nd is CustomerID? Set your Argument to that Control.


                            • #15
                              Re: Session variable from a list control

                              Yes and yes. So you would think this would be easy.

                              Set the argument name, set the variable {CustomerID2} (which is the field the customer ID appears in on the UX.

                              But... when I run it, nothing. I put =:custid2 into a field to see what was being shown and the field showed {CustomerID2} and not the number.
                              Screen Shot 2016-08-10 at 7.35.05 PM.png

                              Here's my argument screen.
                              Screen Shot 2016-08-10 at 7.35.55 PM.png

                              It's pulling a Numeric field. I set them to Character to see what they were showing. If I set the fields to Numeric, it just shows 0. Any idea?