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

UX List's custom Control (column) - to access UX control in xbasic/server

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

    UX List's custom Control (column) - to access UX control in xbasic/server

    In UX List I have added a custom Control (column) shown below. This on the List Builder > Fields Tab (second tab)/properties.
    It needs to access the value of field in the UX component [say {dialog.object}.getValue('text1') - this is on client side, but need to access the text1 on server]

    I tried e.text1, Request.Variables.V.R1.text1 and also tmpl.text1, but with no success. How do I access this?
    I debugged the tmpl, but could not see this control on it. Help.

    function CUSTOM_ITEM1_render as c (ds as p, tmpl as p)
    'Specify the Xbasic that returns the HTML for this control.
    'This function must return CUSTOM_ITEM1_render, which should
    'contain the HTML that will be displayed.
    'The 'ds' argument that is passed in contains the current
    'values for each of the fields in the current List row.
    'For example: ds.data("Firstname")

    '-------------------------------------------------------------------
    on error goto CUSTOM_ITEM1_xbasicError

    'Write Xbasic code here that returns the HTML to be displayed by this control

    CUSTOM_ITEM1_render = ds.data("col1") + ds.data("col2") + tmpl.text1

    end
    CUSTOM_ITEM1_xbasicError:
    CUSTOM_ITEM1_render = "Error in custom control xbasic: " + error_text_get()
    end function
    Regards!

    #2
    Re: UX List's custom Control (column) - to access UX control in xbasic/server

    Maybe you can do everything client side & save a roundtrip to the server ? See this video http://www.ajaxvideotutorials.com/V1...clientside.swf
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

    Comment


      #3
      Re: UX List's custom Control (column) - to access UX control in xbasic/server

      Frank. Thanks. I needed this column from server as there are other calculations that are need to be on server side, therefore I chose server side computed column. (sorry, did not mention this in my first post).

      If unable to access complete e object can I access state variables created in JS shown below on server xbasic. How to access that?

      {dialog.object}.setStateInfo({MyField1: 'myvalue1'});

      Regards!

      Comment


        #4
        Re: UX List's custom Control (column) - to access UX control in xbasic/server

        Did you check out these videos http://www.ajaxvideotutorials.com/V1...bles_part1.swf http://www.ajaxvideotutorials.com/V1...bles_part2.swf
        Frank

        Tell me and I'll forget; show me and I may remember; involve me and I'll understand

        Comment


          #5
          Re: UX List's custom Control (column) - to access UX control in xbasic/server

          Thank you Frank.
          UX List's custom Control (column) seems to not have access to the 'e' object or even state variables. It is very strange that the server logic is not able to access this. tmpl that is the component, that it has access and the row elements using ds.data(...) - that's it.
          Hopefully, there is a way to access that. Meanwhile, I have a workaround where I am saving the values I need into a temp table and accessing the values from the same table in the above.

          Can anyone please confirm that the UX LIST's server side computed column's xbasic logic does not have access to the 'e' object and therefore cannot read the value of any other control (fields) or data elements on the UX, other than just the values in the current rows of the list.

          Regards!

          Comment


            #6
            Re: UX List's custom Control (column) - to access UX control in xbasic/server

            if the list is being rendered on the initial render of the ux, then it would be meaningless to expect access to the value of controls or of the state variables.

            however, if the list is being rendered on an ajax callback (for example, if the user clicked a button to refresh the list), then your xbasic can reference 'request.variables'. this will have all of the variables that are submitted when the request is made. this will include the value in all controls on the UX and the state variables. so while the 'e' object is not passed to the xbasic, you can still likely find what you want in 'request.variables'.

            Comment


              #7
              Re: UX List's custom Control (column) - to access UX control in xbasic/server

              Thank you so much. Request.Variables.V.R1.text1 works now.

              After reading your post, the concept is clearer now. Request.Variables.V.R1.text1 did not work before, because the list was been populated during the initial rendering of list and was referring this object [Request.Variables.V.R1.text1] that did not exist during the initialization. This was not required. Changing the 'Delay populate List till active search' on the List builder properties search Tab now avoids the errors that I was getting.

              Regards!

              Comment


                #8
                Re: UX List's custom Control (column) - to access UX control in xbasic/server

                We have this piece of code that works in development. It works on the server in the office.

                It does not work when deployed to a server in the UK.

                We have uninstalled Alpha and reinstalled the webserver, all to no avail.

                Is there anything else we can try?


                function xsaved as c (e as p)


                dim conn as SQL::Connection

                conn.open("::Name::MySQL_Daybook")




                sql_insert1 = "insert into transactions (`Bank Account`, `In`, `Out`, Date, `Nominal Code`, Type, Description, Pounds) values (:a_Save_Bank_Acc, :a_Save_In, :a_Save_Out, :a_Save_Date, :a_Save_Nominal, :a_Save_Type, :a_Save_Description, :a_Save_Pounds)"


                dim args as sql::arguments

                args.add("a_Save_Bank_Acc", request.variables.v.r1.Save_Bank_Acc)
                args.add("a_Save_In", request.variables.v.r1.Save_In )
                args.add("a_Save_Out", request.variables.v.r1.Save_Out)
                args.add("a_Save_Type", request.variables.v.r1.Save_Type )
                args.add("a_Save_Date", request.variables.v.r1.Save_Date)
                args.add("a_Save_Nominal", request.variables.v.r1.Save_Nominal )
                args.add("a_Save_Description", request.variables.v.r1.Save_Description)
                args.add("a_Sav e_Pounds", request.variables.v.r1.Save_Pounds)


                ? conn.execute(sql_insert1,args) = .T.


                end function

                Comment


                  #9
                  Re: UX List's custom Control (column) - to access UX control in xbasic/server

                  are you sure that the connection string 'MySQL_Daybook' is not defined on your server. check the a5_connection.a5i file on your server.

                  also, i see that your code does not have any error reporting in it. this is not a best practice.

                  for example, you should be doing

                  dim flag as l
                  flag = cn.open("your named connection string")
                  if flag = .f. then
                  ? "Error. Could not open connection. Error reported was" + cn.callresult.text
                  exit function

                  Comment


                    #10
                    Re: UX List's custom Control (column) - to access UX control in xbasic/server

                    When we hard code with values it works perfectly.

                    args.add("a_Save_Bank_Acc", 1) etc.

                    We can update the database in Navicat and Alpha.

                    Comment


                      #11
                      Re: UX List's custom Control (column) - to access UX control in xbasic/server

                      here is what you say is working:

                      Code:
                      args.add("a_Save_Bank_Acc", 1)


                      here is what you say it not working:

                      Code:
                      args.add("a_Save_Bank_Acc", request.variables.v.r1.Save_Bank_Acc)

                      it is clear why the pattern that is not working is not working.

                      in the case that is working you are setting the a_Save_Bank_Acc to a NUMERIC value.

                      in the case that is not working you are setting the sargument to a STRING value.
                      (becuase all variables in a web app that are submitted to a server are string - in Alpha Anywhere, PHP, ASP.NET or any other technology)

                      so the argument is the wrong data type.
                      if your code reported back when there were errors, then you would have seen the error message,

                      you need to change your code to convert the value to a number.

                      e.g.

                      Code:
                      args.add("a_Save_Bank_Acc", convert_type( request.variables.v.r1.Save_Bank_Acc, "N") )

                      Comment


                        #12
                        Re: UX List's custom Control (column) - to access UX control in xbasic/server

                        Thanks Selwyn

                        This works ... will add error checking before we go to production.

                        function xxxsave as c (e as p)



                        dim conn as SQL::Connection

                        conn.open("::Name::MySQL_Daybook")




                        sql_insert1 = "insert into transactions (`Bank Account`, `In`, `Out`, Date, `Nominal Code`, Type, Description, Pounds) values (:a_Save_Bank_Acc, :a_Save_In, :a_Save_Out, :a_Save_Date, :a_Save_Nominal, :a_Save_Type, :a_Save_Description, :a_Save_Pounds)"


                        dim args as sql::arguments

                        args.add("a_Save_Bank_Acc",convert_type(request.variables.v.r1.Save_Bank_Acc, "N"))
                        args.add("a_Save_In", convert_type(request.variables.v.r1.Save_In, "N" ))
                        args.add("a_Save_Out", convert_type(request.variables.v.r1.Save_Out, "N"))
                        args.add("a_Save_Type", request.variables.v.r1.Save_Type )
                        args.add("a_Save_Date", convert_type(request.variables.v.r1.Save_Date , "D"))
                        args.add("a_Save_Nominal", request.variables.v.r1.Save_Nominal )
                        args.add("a_Save_Description", request.variables.v.r1.Save_Description)
                        args.add("a_Save_Pounds", convert_type(request.variables.v.r1.Save_Pounds, "N"))



                        ? conn.execute(sql_insert1,args) = .T.

                        end function

                        One interesting point is that it worked in house in the incorrect format. It was only by transferring it to another development machine and editing that we produced a working edition on the server.

                        Michael

                        P.S. Alpha's help and response on the message board is awesome, everything was my fault and inexperience but still people jump in to help.

                        Thank You.

                        Comment

                        Working...
                        X