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

Programmatically update List source function

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

    Programmatically update List source function

    Sorry to bother you all with my list questions. I have a list (alpha control type List) that has the source as custom and the underlying function is "xbasic_populate_my_list1"
    It works fine. Now when I click a button I wish to change the source of the custom to another underlying function is "xbasic_populate_my_list2" Is it possible.
    xBasic or javascript solution will work. Thanks!

    #2
    Re: Programmatically update List source function

    Are all the fields the same between list1 and list2? Seems they'd have to be. And... if so... then I would use one XBasic source to return either list1 or list2 data.

    Comment


      #3
      Re: Programmatically update List source function

      David, I just have one list 'list1', but have 2 xBasic functions 'xbasic_populate_my_list1' and 'xbasic_populate_my_list2'
      When I designed the list 'list1', I set the source property as custom and give the xBasic function name 'xbasic_populate_my_list1'
      Now, I wish to add a button whose code [xBasic or Javascript] will update the source xBasic function of list 'list1' from 'xbasic_populate_my_list1' to 'xbasic_populate_my_list2'
      Is this possible? Thanks!

      Comment


        #4
        Re: Programmatically update List source function

        Understood... but my question wasn't phrased quite properly. You're returning data from 'xbasic_populate_my_list1' and 'xbasic_populate_my_list2'. Are the same fields being returned? Same number of columns and same field names from both xbasic functions?

        Comment


          #5
          Re: Programmatically update List source function

          Yes David. They are exactly the same. Same number of columns and same field names from both xbasic functions.

          Comment


            #6
            Re: Programmatically update List source function

            Excellent... then instead of trying to figure out how to dynamically change the source of a list just call one xbasic function that combines the logic of your two functions. That's going to be much simpler in the end, easier for changes etc. The direct answer is... I have no idea if you can programmatically change the source - probably - this is Alpha - but I'm going to guess it's fraught with perils... which is a phrase you don't get to use much these days.

            Your button push must have some login in it that decides which data function to run. Put that logic into one function and figure out your data from there.

            Comment


              #7
              Re: Programmatically update List source function

              Thanks. I tried that but I was getting error message when the app starts up. This is because some of the fields are not defined (rendered) at that time the app is starting up. The message says that '"e.rv.V.R1.TEXTBOX1" is not defined' when the app is starting up in the example below. After the initial start up - it worked fine.
              So I was thinking to use another function that shows default values from another xBasic function - or blanks. Later, a button would change the source to the following xbasic function - I thought. Maybe 1) somehow I should ignore this field not defined during application startup or 2) not let the list populate - let it be blank - later the button would populate it based in this field. I do not know how to do 1) or 2) above - help!

              function xbasic_populate_my_list1 as c (e as p)
              if e.rv.V.R1.TEXTBOX1 = "100" then
              txt = <<%txt%
              [
              {firstname: 'Fred100', lastname: 'Smith100'} ,
              {firstname: 'richard100', lastname: 'smith100'}
              ]
              %txt%
              else
              txt = <<%txt%
              [
              {firstname: 'Fred200', lastname: 'Smith200'} ,
              {firstname: 'richard200', lastname: 'smith200'}
              ]
              %txt%
              end if
              xbasic_populate_my_list1 = txt

              BTW: I have another post with similar issue - I will update that post with the link to this post if I get help resolving this issue.

              Comment


                #8
                Re: Programmatically update List source function

                I think you need to use the current syntax for REQUEST variables and also use the variable_exists function to help build the List.

                Have a look...

                http://www.youtube.com/watch?v=q0eLDfKxKl0


                Code:
                function xbasic_populate_my_list1 as c (e as p)
                	
                	
                if variable_exists("Request.Variables.TEXTBOX1") then
                
                	if Request.Variables.TEXTBOX1 = "100" then
                
                txt = <<%longstring%
                [
                {firstname: 'Fred100', lastname: 'Smith100'} ,
                {firstname: 'richard100', lastname: 'smith100'}
                ]
                %longstring%
                
                else
                
                txt = <<%longstring%
                [
                {firstname: 'Fred200', lastname: 'Smith200'} ,
                {firstname: 'richard200', lastname: 'smith200'}
                ]
                %longstring%
                end if
                
                else
                
                txt = <<%longstring%
                [
                {firstname: 'Fred100', lastname: 'Smith100'} ,
                {firstname: 'richard100', lastname: 'smith100'}
                ]
                %longstring%
                
                end if
                
                xbasic_populate_my_list1 = txt
                
                
                end function

                Comment


                  #9
                  Re: Programmatically update List source function

                  David,

                  Thank you so much!!

                  It works great now.

                  function xbasic_populate_my_list1 as c (e as p)

                  if variable_exists("e.rv.V.R1.TEXTBOX1") then
                  if e.rv.V.R1.TEXTBOX1 = "100" then
                  txt = <<%txt%
                  [
                  {firstname: 'Fred100', lastname: 'Smith100'} ,
                  {firstname: 'richard100', lastname: 'smith100'}
                  ]
                  %txt%
                  else
                  txt = <<%txt%
                  [
                  {firstname: 'Fred200', lastname: 'Smith200'} ,
                  {firstname: 'richard200', lastname: 'smith200'}
                  ]
                  %txt%
                  end if
                  else
                  txt = <<%txt%
                  [
                  {firstname: '', lastname: ''}
                  ]
                  %txt%
                  end if

                  xbasic_populate_my_list1 = txt

                  end function

                  Comment


                    #10
                    Re: Programmatically update List source function

                    Excellent... glad it worked out. As mentioned above... this is from the supplied notes in an Ajax Callback...

                    'Request - The Request object. Includes Request.Variables, which should be used instead of the older e.rv construct
                    Here's another method described by Selwyn... really great stuff... from the pre-release release notes... and there's a component available to download in the notes as well.

                    http://www.ajaxvideotutorials.com/V1...eFromSQL_1.swf
                    http://www.ajaxvideotutorials.com/V1...eFromSQL_2.swf
                    Last edited by Davidk; 03-13-2014, 02:11 PM.

                    Comment


                      #11
                      Re: Programmatically update List source function

                      Thanks. My logic may involve repeating fields too, so used the e.rv variables. I will followup with the documents you provided the link and will check out if the request variables let me access repeating container fields. Thanks again. Really appreciate your help!

                      Comment


                        #12
                        Re: Programmatically update List source function

                        Thanks. I am now using Request Variables instead or e.rv variables (Request.Variables.V.R1.TEXTBOX1 instead of e.rv.V.R1.TEXTBOX1.) Thanks for pointing that out.

                        Comment


                          #13
                          Re: Programmatically update List source function

                          David,
                          please expand a bit on the request variable part. I have followed the videos in this thread, first starting with Selwyn's to pupulate the list using xbasic and then went back to your video where you mention of a request var and you entering it at the URL. I have build the component as shown but not getting the result

                          my url defaults to

                          "http://localhost/LivePreview/Sakila_List01_PageLayoutLivePreview.a5w?231153652"

                          and I hence add the code as shown below but not getting the code to 'switch' to the portion as shown.

                          "http://localhost/LivePreview/Sakila_List01_PageLayoutLivePreview.a5w?231153652?TEXTBOX1=200"

                          Code:
                          function xbasic_populate_motorsport as c (e as p)
                          'debug(1)	
                          	
                          if variable_exists("Request.Variables.TEXTBOX1") then
                          
                          	if Request.Variables.TEXTBOX1 = "100" then
                          		txt = <<%longstring%	
                          		[
                          		{driver: '1 Nico Rosberg', car: 'Mercedes'},
                          		{driver: '2 Kevin Magnussen', car: 'McLaren'},
                          		{driver: '3 Jenson Button', car: 'McLaren'},
                          		{driver: '4 Fernando Alonso', car: 'Ferrari'}
                          		]
                          		%longstring%
                          	else
                          		txt = <<%longstring%	
                          		[
                          		{driver: 'Valtteri Bottas', car: 'Williams'},
                          		{driver: 'Nico Hulkenberg', car: 'Force India'},
                          		{driver: 'Kimi Raikkonen', car: 'Ferrari'},
                          		{driver: 'Jean-Eric Vergne', car: 'Toro Rosso'}
                          		{driver: 'Daniil Kvyat', car: 'Toro Rosso'}
                          		{driver: 'Sergio Perez', car: 'Force India'}
                          		]
                          		%longstring%
                          	end if
                          	
                          else
                          	txt = <<%longstring%	
                          	[
                          	{driver: '-Nico Rosberg', car: 'Mercedes'},
                          	{driver: '-Kevin Magnussen', car: 'McLaren'},
                          	{driver: '-Jenson Button', car: 'McLaren'},
                          	{driver: '-Fernando Alonso', car: 'Ferrari'}
                          	]
                          	%longstring%
                          
                          end if
                          
                          xbasic_populate_motorsport = txt
                          end function
                          Last edited by kotinkarwak; 03-21-2014, 07:25 PM.
                          Regards,

                          Kotin Karwak
                          Developer Edition
                          Version 12.3 Build 2684
                          System Addins: Build 4438
                          Build machine Windows Vista
                          Skype: mateso08

                          Comment


                            #14
                            Re: Programmatically update List source function

                            Your URL syntax is incorrect. Using your example I believe it would be...

                            Code:
                            "http://localhost/LivePreview/Sakila_List01_PageLayoutLivePreview.a5w?231153652&TEXTBOX1=200"
                            A variable string is characterized at the beginning by a question mark ? followed, usually, by a name=value pair. Then 2nd and subsequent variables are delimited by the & sign.

                            So... change your 2nd ? to & and you should be good.

                            Comment


                              #15
                              Re: Programmatically update List source function

                              Thanks David, I now understand that part of the syntax.
                              Regards,

                              Kotin Karwak
                              Developer Edition
                              Version 12.3 Build 2684
                              System Addins: Build 4438
                              Build machine Windows Vista
                              Skype: mateso08

                              Comment

                              Working...
                              X