mljonzs
Posts: 124
|
Posted: 01/20/2009, 3:03 PM |
|
Hello.
I have a request for creating an editable grid report form that includes sub_totals for various breakdowns. I'm not sure how to incorporate sub_totalling into an editable grid??? Does anyone have any ideas?
For example, I have a report that has 6 columns - user, subUser, status, Amount1, amount2, Amount3.
The users want default sort on user with subtotals for user for each of the Amount columns (because it was originally sorted by user. If sort changes to SubUser, the sub_totals on the Amount columns need to be re-calculated. And to make it more challenging, they want to be able to go through and change Amount values then click submit for a one-time, multiple update.
Can I incorporate this sub-total functionality into an editable grid? If so, how do I go about doing this?
Thanks!
_________________
What does not begin WITH God, will end in failure!
|
|
|
Oper
Posts: 1195
|
Posted: 01/20/2009, 4:00 PM |
|
its not complicated but will required few tricks
Step are:
1) Insert a 2nd row in the Editable Grid
2) Clear all space on all that Cell from that row (CCS add one space to eahc cell)
3) add Label to the Row that Need the Total (amount1-2-3)
and just fill those Label when users Change.
Really not hard just Tricky.
Let me know if worked for you.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
mljonzs
Posts: 124
|
Posted: 01/22/2009, 10:31 AM |
|
HI Oper,
Thanks for the information. I haven't gotten to adding the subtotal stuff just yet as I'm having difficulty with my custom updates for this thing. The Grid Source is a view that combines two tables. The update fields go into two separate tables so I have created a stored procedure to handle the updates. The sp works just fine but I when I go into my editable grid and choose Custom Update Type Procedure and then select my proc and configure all the parameters, it does not work. I update data on a record in the editable grid and click submit. No errors display that I can find but the data does not update either.
I'm not sure if what I'm doing wrong here --- I've never used stored procedures in CCS yet so maybe I'm just not configuring things correctly. Most of my parameters come from the grid so I chose Control Type and verify that DataType for each matches the proc parameter. One parameter is pulled from an application cookie and again I matched data type to proc parm type. I'm not sure what to do with the SP return value parameter - I don't really need it right now, or do I?
Can Anyone help with this problem? I can't even get a single Update SQL statement to work in Custom Updates? (And yes, The Allow Update property is set to Yes for the grid too).
_________________
What does not begin WITH God, will end in failure!
|
|
|
Oper
Posts: 1195
|
Posted: 01/22/2009, 11:36 AM |
|
Personaly, i avoid the use of Custom SQL/Procedure at form design.
1) first i just use normal update and forget for the moment the 2nd update.
whne everthing is workign as spected:
2) after execute event of the form i do my update by Hand
more coding but safe this way and easiets
just something like these:
strSQL="UPDATE table set CAMPO1=" & yourvalue & " where whateverID=" & valueID
then
dbconnection1.execute(strSQL)
NOTE: writed directly withotu cheqking posible mystype, but tha's the idea
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
mljonzs
Posts: 124
|
Posted: 01/22/2009, 11:50 AM |
|
I thought about this but if I don't do custom update, I get CCS error because my view which is the basis for the grid does not allow direct updates.....
On a side note, I did finally get my custom SP to work for me -- I had placed a control on my grid as hidden for one of my parameters but I forgot to bind it to the data so the updates never worked....
Thanks for you input tho - you have NO idea how much I appreciate it! =)
_________________
What does not begin WITH God, will end in failure!
|
|
|
mljonzs
Posts: 124
|
Posted: 01/22/2009, 2:22 PM |
|
Okay, I've hit a problem. The custom Update works except that EVERY record gets updated whether it needs it or not - this is BAD.
I'm poking around with ideas to prevent this so only data that needs updated gets updated but I'm hitting issues since this is on an editable grid. Is my best option to do some manipulation in the Before Execute Update method to disable the Update execution for rows that don't need updated? I can do this, but isn't there some way to set up a flag (without storing anything in the DB) to check that indicates a given row has been changed.
I've tried to create a hidden field that I set via OnChange of editable fields using javascript, but I'm having problems figuring out exactly how to set the the value for the correct row and then recognizing that at update time (when user clicks Submit)
....help?
_________________
What does not begin WITH God, will end in failure!
|
|
|
Oper
Posts: 1195
|
Posted: 01/22/2009, 6:09 PM |
|
i get confused a litle here.
why you need to preveent som row to be updated?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
mljonzs
Posts: 124
|
Posted: 01/22/2009, 8:00 PM |
|
Well, I don't want to update every single record in the editable grid - there could be 200 or more records and the user only changes 2 or 3. Why would I want to perform an update on all 200+ records?
I am guessing it is doing every row because the way I set it up - the form display is based on a multi-table view. When user changes value(s) in a row, the update needs to update data in two different tables so the stored proc handles that for me...
Perhaps I confused you because I said Quote :The custom Update works except that EVERY record gets updated by EVERY record, I meant every row of my grid -- ie every record in the DB tables that comprise each grid row.
_________________
What does not begin WITH God, will end in failure!
|
|
|
Oper
Posts: 1195
|
Posted: 01/24/2009, 7:48 AM |
|
ml,
so untill now everthing is work ok.
but the update part?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
mljonzs
Posts: 124
|
Posted: 01/24/2009, 4:33 PM |
|
Hi Oper,
I got the updates working finally (I added some logic in the BeforeExecuteUpdate to abort the update if nothing changed) but have not yet completely figured out how to do the subtotals as first asked for. That is still a requirement but first the want the raw data so I'm cleaning up the project for them to use and then I will go back and try to implement the subtotalling. I did start it but was not yet far enough with it to know if it would work for me. I will let you know - sometime next week.
Thanks for asking!
mlj
_________________
What does not begin WITH God, will end in failure!
|
|
|
Oper
Posts: 1195
|
Posted: 01/24/2009, 9:12 PM |
|
mljonzs,
for now just keep it like that, clean your code (i could help you with the subtotals when the first part is set)
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
|