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

Update a groupSummary field value wihout refresh whole grid?

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

    Update a groupSummary field value wihout refresh whole grid?

    Hi All,

    I a parent grid with a Group Header and a couple of link grids that can drill down 2 tables, when making changes to one of the child grids will affect the values shown in a groupSummary field in the parent grid, so far the only way I found out to update the groupSummary field is by refreshing the whole grid which cause a lot of flickering, is there a method or some other manual way to update the groupSummary field value without having to refresh the whole grid?

    Thanks!!!
    Attached Files
    Edhy Rijo
    Progytech
    (Computer Consultants)
    The makers of CardTracking.Net
    www.progytech.com

    #2
    Re: Update a groupSummary field value wihout refresh whole grid?

    Hi all,
    With some guidance from Selwyn (thanks Selwyn) and some code I was able to update my grid Group Header totals while updating a record in a child link grid that affected those group summary totals.

    Here is what I did:
    1. Wrap the groupSummary.FieldNameCount fields with an id= tag to identify those fields later on.
    2. I have a javascript function jsRefreshStudentGrid() that will handle the refresh of the parent grid, in this method I added an ajaxCallback to call an Xbasic function to calculate the totals.
    3. In my Xbasic function xbRecalculateGroupHeaderCounters() I then run an SQL statement to grab the totals and then return an e.rtc.A_AjaxResponses to update my Element IDs using document.GetElementById
    4. I call the jsRefreshStudentGrid() function from the grid afterDetailViewSubmit() and afterDetailViewDeleteRecord() events.

    Here are the functions:
    Code:
    //Refresh the StudentGrid and update its Group Header totals
    //This function will call an ajaxCallback to calculate the Group Header totals.
    function jsRefreshStudentGrid()
    {
        // Get the parent object which is the StudentsGrid and if
        // exist, refresh it.
        var pObj = {grid.Object}.getParentObject();
    	
        if (typeof pObj=="object")
        {
            //Get the row for the parent
            var prowNum = pObj._selectedRow;
    		
            //Refresh the current row for the parent
            pObj.refreshRow(prowNum);
    
            // Get all the values for the Search part fields and call an Ajax CallBack 
            // to calculate the Total IEP hours and minutes.
            var vStudentIsInactive = pObj.getValue('S','STUDENTISINACTIVE');
    
            //Getting value of 'range' fields in the Search part. You can't use .getValue(). You have to use low level Javascript.
            //so lets get the ParentGridAlias name so we can reference the date range field correctly.
            //Sample: var val1 = $('{grid.componentname}.S.STARTDATE').value;
            var pAlias = {Grid.object}.parentGridAlias;
            var vDateOfBirthStart = $(pAlias + '.S.DATEOFBIRTH').value;
            var vDateOfBirthEnd   = $(pAlias + '.S._TO.DATEOFBIRTH').value;
    
            //Get other search field values
            var vHomeDistrict = pObj.getValue('S','HOMEDISTRICT');
            var vFirstName = pObj.getValue('S','FIRSTNAME');
            var vLastName = pObj.getValue('S','LASTNAME');
            var vProvider1FullName = pObj.getValue('S','PROVIDER1FULLNAME');
            var vProvider2FullName = pObj.getValue('S','PROVIDER2FULLNAME');
            var vSiteName = pObj.getValue('S','SITENAME');
            var vNYCIDNumber = pObj.getValue('S','NYCIDNUMBER');
    
            //Prepare the ajaxCallback addional data pair values from the search part field values
            var vAdditionalData = 'vStudentIsInactive=' + vStudentIsInactive + '&vDateOfBirthStart=' + vDateOfBirthStart + '&vDateOfBirthEnd=' + vDateOfBirthEnd
            vAdditionalData = vAdditionalData + '&vHomeDistrict=' + vHomeDistrict
            vAdditionalData = vAdditionalData + '&vFirstName=' + vFirstName + '&vLastName=' + vLastName
            vAdditionalData = vAdditionalData + '&vProvider1FullName=' + vProvider1FullName + '&vProvider2FullName=' + vProvider2FullName
            vAdditionalData = vAdditionalData + '&vSiteName=' + vSiteName + '&vNYCIDNumber=' + vNYCIDNumber
    
            //Call the Xbasic xbRecalculateGroupHeaderCounters with an ajaxCallback
            {grid.Object}.ajaxCallback('D','1','xbRecalculateGroupHeaderCounters','', vAdditionalData);
        }
    }
    Code:
    '-- This function is called from the js function jsRefreshStudentGrid
    '   It will expect all values used in the search part to calculate the
    '   Total IEP Hours and Minutes counter used in the Group Header of the StudentGrid
    function xbRecalculateGroupHeaderCounters as c (e as p)
    	
    	dim cn as sql::Connection
    	dim args as sql::Arguments	
    	dim rs as SQL::ResultSet
    	dim vSelect as c
    
    	'-- Process Arguments passed from the jsRefreshStudentGrid function data pair values
    	if e.vStudentIsInactive = "" then
    		args.add("StudentIsInactive", 0)
    	else
    		args.add("StudentIsInactive", convert_type(e.vStudentIsInactive,"N"))	
    	end if
    	
    	args.add("HomeDistrict", convert_type(e.vHomeDistrict,"N"))
    
    	'-- If dates are blank, then set them to 1/1/1800
    	if e.vDateOfBirthStart = "" .or. e.vDateOfBirthEnd = "" then
    		args.add("DateOfBirthStart", convert_type("1/1/1800","D"))
    		args.add("DateOfBirthEnd", convert_type("1/1/1800","D"))
    	else
    		args.add("DateOfBirthStart", convert_type(e.vDateOfBirthStart,"D"))
    		args.add("DateOfBirthEnd", convert_type(e.vDateOfBirthEnd,"D"))
    	end if
    	
    	args.add("FirstName", e.vFirstName)
    	args.add("LastName", e.vLastName)
    	args.add("Provider1FullName", e.vProvider1FullName)
    	args.add("Provider2FullName", e.vProvider2FullName)
    	args.add("SiteName", e.vSiteName)
    	args.add("NYCIDNumber", e.vNYCIDNumber)
    
    	'-- Create SQL to calculate the group totals using the current values
    	'   in the Search Part.
    	vSelect =<<%txt%
    		SELECT
    			 COALESCE(SUM(v.FrequencyHours), 0) AS FrequencyHours,
    			 COALESCE(SUM(v.FrequencyMinutes), 0) AS FrequencyMinutes
    		FROM
    			 Students s
    			 LEFT OUTER JOIN Providers p      ON s.FK_Providers = p.PK_Providers 
    			 LEFT OUTER JOIN Providers p2     ON s.FK_Providers2 = p2.PK_Providers 
    			 LEFT OUTER JOIN ClassSites cs    ON s.FK_ClassSites = cs.PK_ClassSites 
    			 LEFT OUTER JOIN vIEP_Frequency v ON s.PK_Students = v.FK_Students 
    		WHERE
    			(s.StudentIsInactive = :StudentIsInactive OR :StudentIsInactive IS NULL) AND
    			((s.DateOfBirth >= :DateOfBirthStart AND s.DateOfBirth <= :DateOfBirthEnd) OR :DateOfBirthStart = '1/1/1800') AND
    			(s.HomeDistrict = :HomeDistrict OR :HomeDistrict = 0) AND
    			(s.FirstName = :FirstName OR :FirstName = '') AND
    			(s.LastName = :LastName OR :LastName = '') AND
    			(p.cfpFullName = :Provider1FullName OR :Provider1FullName = '') AND
    			(p2.cfpFullName = :Provider2FullName OR :Provider2FullName = '') AND
    			(cs.SiteName = :SiteName OR :SiteName = '') AND
    			(s.NYCIDNumber = :NYCIDNumber OR :NYCIDNumber = '')
    	%txt%
    
    	'-- Open the connection and calculate the group totals
    	if cn.open("::name::BCI") then
    		if cn.execute(vSelect,args) = .t.
    			rs = cn.ResultSet
    			if eval_valid("rs.data(1)") then
    				dim currentIEPHoursCount as n = rs.data("FrequencyHours")
    				dim currentIEPMinutesCount as n = rs.data("FrequencyMinutes")
    				
    				dim myjs as c =<<%js%
    				document.getElementById('IEPHoursCount').innerHTML = {currentIEPHoursCount} ;
    				document.getElementById('IEPMinutesCount').innerHTML = {currentIEPMinutesCount} ;
    				%js%
    				
    				'-- Update the Group Header totals using the getElementByID IN myjs
    				aa = e.rtc.A_AjaxResponses
    				aa[].text = evaluate_string(myjs)
    				aa[..].id = 100  'the order in which AjaxResponses are sent to the browser
    			end if
    		end if
    		cn.close()
    	end if	
    end function
    Hope this can help somebody else and please, if you see a better way to handle the code or any suggestion to improve any part of this code, please let me know.
    Last edited by Progytech; 10-03-2013, 09:43 AM.
    Edhy Rijo
    Progytech
    (Computer Consultants)
    The makers of CardTracking.Net
    www.progytech.com

    Comment

    Working...
    X