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

Totalling payments due vs. payments made

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

    #16
    Re: Totalling payments due vs. payments made

    That's all great, I'm making some real progress now!

    I'll show you what I have so far.
    Since the grid I'm performing the callback on is a child, I get the relational key from the parent. If it gets that value I perform the callback and pass the key:
    Code:
    var po = {grid.Object}.getParentObject();
    if po(){
    	var holID = po.getValue('G', 'COMBO', po._selectedRow);
    	{grid.Object}.ajaxCallback('G','{Grid.RowNumber}','sumHols','','_getData=true&comboid='+holID);
    }
    My function, sumHols(), is pretty similar to the one you posted with a few changes to make it work for my purposes, but I'm still tweaking it right now. Hopefully will have it working in the next hour!

    Hopefully

    Comment


      #17
      Re: Totalling payments due vs. payments made

      Are these errors informative at all? They always seem to put out the same message (unless I just keep making the same error!)
      err0r.jpg

      The function looks in order but these errors are popping up in threes;
      the one about the missing '(' and 2 about not being able to identify Grid1_GridObj. I assume the latter 2 are thrown up in response to the first error.

      Comment


        #18
        Re: Totalling payments due vs. payments made

        Unless someone here knows better, I always have such trouble with these errors... some of the time they're right... about missing a semi-colon etc. But other times who knows.

        is this the code giving the error?

        Code:
        var po = {grid.Object}.getParentObject();
        if po(){
        	var holID = po.getValue('G', 'COMBO', po._selectedRow);
        	{grid.Object}.ajaxCallback('G','{Grid.RowNumber}','sumHols','','_getData=true&comboid='+holID);
        }

        Comment


          #19
          Re: Totalling payments due vs. payments made

          Ah, yes it is. The issue was the if statement; it should have been if (po){
          I was to busy scouring the function code to spot it!

          Comment


            #20
            Re: Totalling payments due vs. payments made

            More times than I care to admit it's a { or }. Coming from a bunch of basic languages I'm finally starting to know them as "then" and "end if". I put them in right away now so I don't miss them as much.

            Comment


              #21
              Re: Totalling payments due vs. payments made

              Gonna drop this code on you for one last look (hopefully)

              I'm getting this error after publishing and displaying the grid online:
              Error executing Ajax callback function 'sumHols' Error reported was: command: holTotal = rs.data(1) Function sequence error. while getting result set data column.'
              Here's what I have at the moment
              Code:
              function sumHols as c (e as p)
              	dim curCombo as c 
              	'comboid passed via the callback
              	curCombo = e.comboid
              
              	dim cn as sql::connection
              	dim cs as c
              
              	cs = e.tmpl.cs.connectionString	
              
              	dim flag as l 
              	flag = cn.open(cs)
              	if flag = 0 then 
              		dim msg as c 
              		msg = "Could not connect to database. Error reported was: " + cn.CallResult.text
              		msg = js_escape(msg)
              		dim jscmd as c 
              		jscmd = "alert('" + msg + "');"
              		sumHols = jscmd
              		exit function 
              	end if
              
              	dim sql as c 
              	sql = "select Sum(NO_DAYS) as TOTAL_DAYS from sql_holiday_detail where COMBO = :parentCombo"
              	dim args as sql::arguments
              	args.add("parentCombo",curCombo)
              	
              	flag = cn.Execute(sql,args)
              	if flag = 0 then
              		cn.Close()
              		dim msg as c
              		msg = "Could not execute the Sum query. Error reported was: " + cn.CallResult.text
              		msg = js_escape(msg)
              		dim jscmd as c
              		jscmd = "alert('" + msg + "');"
              		sumHols = jscmd
              		exit function
              	end if
              
              	dim rs as sql::resultset
              	rs = cn.ResultSet
              
              	dim holTotal as n
              	holTotal = rs.data(1)
              
              	dim jscmd as c 
              	jscmd = "$('div1').innerHTML = 'Days used by " + curCombo + " - " + holTotal + "';"
              	sumHols = jscmd
              end function
              The error seems to suggest a problem with the data returned. I'll have to leave this until tomorrow for now, but I'll look into arrays and the information passed in the resultset, maybe check the database, and see if I can spot an issue.

              Comment


                #22
                Re: Totalling payments due vs. payments made

                Here's the best way to find a lot of problems. Put a debug(1) statement right at the top of your function and run in Working Preview mode. Then step through the code, checking for variables. See if things get set, returned, etc. as they should.

                Comment


                  #23
                  Re: Totalling payments due vs. payments made

                  Ah, I didn't know about the debug() function. This will really help!

                  Looks like I had some issues with table naming on the database I'm using. Some of them were created with spaces in the names!
                  Changing the names would cause all kinds of issues with the grids. Is there some way of encapsulating the table name in the sql statement?
                  e.g. SELECT * FROM 'table name' WHERE

                  I tried a couple variations with no luck. I'm going to carry on trying to facilitate a name change (since it's now working up to a point), but there are all sorts of problems popping up. Also, rs.data(1) doesn' t seem to be returning a value, but I'll look into that once the database issue is sorted out.

                  Thanks for sticking it out!

                  Comment


                    #24
                    Re: Totalling payments due vs. payments made

                    debug(1) will help you step through to the assignment of the recordset to see if there are any records being returned... my guess is not. That's why you're not getting anything our of rs.data(1).
                    And try this character around your table name `table name`.

                    Comment


                      #25
                      Re: Totalling payments due vs. payments made

                      Sorted out the database naming and determined that ResultSet was returning empty because there were no values in the first record for it to sum
                      It's all done and sorted and I've added a couple of extra bits with what I now know.

                      Learned quite a bit over the last week.
                      Thanks for all the help David; it took a while but we got there in the end! Hopefully this will be a useful thread for anyone looking achieve something similar.
                      Last edited by RaEd.; 08-16-2011, 10:16 AM.

                      Comment


                        #26
                        Re: Totalling payments due vs. payments made

                        Originally posted by Davidk View Post
                        And try this character around your table name `table name`.
                        Using the ` character kicked up some issues for me, it didn't seem to like it at all. In the end I had to rename the table and then went through the grids that used it in the web application and made sure they were using the new name.

                        Comment


                          #27
                          Re: Totalling payments due vs. payments made

                          Odd... I tried it here first to make sure it was ok. Still... better with no spaces 'cause they're always trouble.

                          I've run into the same problem with the resultset returning empty, for whatever reason. Usually some problem I've caused, but just in case I tried to find some way of testing it and just can't find anything. It seems that many properties of the resultset are not available if it's not set - which kinda makes sense. The ones that are available are of no help in testing.

                          Comment

                          Working...
                          X