Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #10384 > unrolled thread
| Started by | Paulo Oliveira <paulofvoliveira@gmail.com> |
|---|---|
| First post | 2017-04-05 13:40 -0700 |
| Last post | 2017-04-06 15:06 -0700 |
| Articles | 6 — 2 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
RecordGroups sum() Paulo Oliveira <paulofvoliveira@gmail.com> - 2017-04-05 13:40 -0700
Re: RecordGroups sum() "Jamal" <noooospam@example.com> - 2017-04-06 15:39 -0400
Re: RecordGroups sum() Paulo Oliveira <paulofvoliveira@gmail.com> - 2017-04-06 14:13 -0700
Re: RecordGroups sum() "Jamal" <noooospam@example.com> - 2017-04-06 17:42 -0400
Re: RecordGroups sum() Paulo Oliveira <paulofvoliveira@gmail.com> - 2017-04-06 14:52 -0700
Re: RecordGroups sum() Paulo Oliveira <paulofvoliveira@gmail.com> - 2017-04-06 15:06 -0700
| From | Paulo Oliveira <paulofvoliveira@gmail.com> |
|---|---|
| Date | 2017-04-05 13:40 -0700 |
| Subject | RecordGroups sum() |
| Message-ID | <465fe4bd-fb45-4468-b0ea-e89e47c38d7d@googlegroups.com> |
Hi all, I need to show the sum of a field in the group header, is it possible? How to make? TIA Paulo Oliveira
[toc] | [next] | [standalone]
| From | "Jamal" <noooospam@example.com> |
|---|---|
| Date | 2017-04-06 15:39 -0400 |
| Message-ID | <oc65hu$6or$1@news.albasani.net> |
| In reply to | #10384 |
Paulo,
In the bBrowser 4.0 samples, there is a sample RecordGroups :
_dtwRecordGroups2 module.
Look at the PostInit( ). I think it should give you some ideas. You create
bCodeblock, then set it to GroupHeader.
// something like the following may work. Of course, you will need to update
the code for your situation.
ocbGroupHeader := bCodeblock{" 'Sum ' + SumFieldFunction(Server:YOURFIELD)",
odbsServer}
oRecordGroupLevel:GroupHeader := bRecordGroupHeader{ocbGroupHeader}
I never used it but, I am sure you can figure it out.
Jamal
"Paulo Oliveira" wrote in message
news:465fe4bd-fb45-4468-b0ea-e89e47c38d7d@googlegroups.com...
Hi all,
I need to show the sum of a field in the group header, is it possible? How
to make?
TIA
Paulo Oliveira
[toc] | [prev] | [next] | [standalone]
| From | Paulo Oliveira <paulofvoliveira@gmail.com> |
|---|---|
| Date | 2017-04-06 14:13 -0700 |
| Message-ID | <8838112a-34ef-4ea7-97cf-a7c0e4ca8d69@googlegroups.com> |
| In reply to | #10391 |
Hi Jamal,
Thank you very much, I really needed a clue like this.
Now it's what I want, my code looks like this:
...
ocbGroupHeader := bCodeblock{"'SEMANA '+Server:SEMPROD+ ' ('+DToC(Server:dPrimDia)+' a '+DToC(Server:dUltDia)+') [CAPACIDADE: '+alltrim(Str(Server:sCarga,6,0))+' CARGA: '+alltrim(Str(SumCampo(Server,Server:SEMPROD,#PARES),6,0))+' DIFERENÇA SEMANAL: '+alltrim(Str((Server:sCarga-SumCampo(Server,Server:SEMPROD,#PARES)),6,0))+']'";
,SELF:oDCbBAcompanhamento:Server}
oRecordGroupLevel:GroupHeader := bRecordGroupHeader{ocbGroupHeader}
oGrid := bGrid{BGRID_OUTLINEHORIZONTAL, , , , , Color{COLORBLACK}}
oFont := SELF:oDCbBAcompanhamento:GetDefaultFont()
oFont:Bold := TRUE
oRecordGroupLevel:GroupView := bViewStyle{ , , BALIGN_LEFT + BALIGN_BOTTOM, oFont, oGrid} // Attributes for the graphical representation of the group values
...
And the function:
FUNCTION SumCampo(obArrayServer,cSearchCampo,symCampo)
LOCAL sSum AS SHORT
LOCAL iRecNo AS SHORT
obArrayServer:Seek(cSearchCampo)
iRecNo:=obArrayServer:RecNo
sSum:=0
obArrayServer:SuspendNotification()
DO WHILE obArrayServer:FIELDGET(#SEMPROD)==cSearchCampo
sSum+=obArrayServer:FIELDGET(symCampo)
obArrayServer:Skip()
ENDDO
obArrayServer:ResetNotification()
obArrayServer:Goto(iRecNo)
RETURN sSum
You can see the final result: :)
https://6i9mhp.s.cld.pt
Paulo
[toc] | [prev] | [next] | [standalone]
| From | "Jamal" <noooospam@example.com> |
|---|---|
| Date | 2017-04-06 17:42 -0400 |
| Message-ID | <oc6cor$nhc$1@news.albasani.net> |
| In reply to | #10393 |
Nice!! I am glad I was of help.
Jamal
"Paulo Oliveira" wrote in message
news:8838112a-34ef-4ea7-97cf-a7c0e4ca8d69@googlegroups.com...
Hi Jamal,
Thank you very much, I really needed a clue like this.
Now it's what I want, my code looks like this:
...
ocbGroupHeader := bCodeblock{"'SEMANA '+Server:SEMPROD+ '
('+DToC(Server:dPrimDia)+' a '+DToC(Server:dUltDia)+') [CAPACIDADE:
'+alltrim(Str(Server:sCarga,6,0))+' CARGA:
'+alltrim(Str(SumCampo(Server,Server:SEMPROD,#PARES),6,0))+' DIFERENÇA
SEMANAL:
'+alltrim(Str((Server:sCarga-SumCampo(Server,Server:SEMPROD,#PARES)),6,0))+']'";
,SELF:oDCbBAcompanhamento:Server}
oRecordGroupLevel:GroupHeader := bRecordGroupHeader{ocbGroupHeader}
oGrid := bGrid{BGRID_OUTLINEHORIZONTAL, , , , , Color{COLORBLACK}}
oFont := SELF:oDCbBAcompanhamento:GetDefaultFont()
oFont:Bold := TRUE
oRecordGroupLevel:GroupView := bViewStyle{ , , BALIGN_LEFT + BALIGN_BOTTOM,
oFont, oGrid} // Attributes for the graphical representation of the group
values
...
And the function:
FUNCTION SumCampo(obArrayServer,cSearchCampo,symCampo)
LOCAL sSum AS SHORT
LOCAL iRecNo AS SHORT
obArrayServer:Seek(cSearchCampo)
iRecNo:=obArrayServer:RecNo
sSum:=0
obArrayServer:SuspendNotification()
DO WHILE obArrayServer:FIELDGET(#SEMPROD)==cSearchCampo
sSum+=obArrayServer:FIELDGET(symCampo)
obArrayServer:Skip()
ENDDO
obArrayServer:ResetNotification()
obArrayServer:Goto(iRecNo)
RETURN sSum
You can see the final result: :)
https://6i9mhp.s.cld.pt
Paulo
[toc] | [prev] | [next] | [standalone]
| From | Paulo Oliveira <paulofvoliveira@gmail.com> |
|---|---|
| Date | 2017-04-06 14:52 -0700 |
| Message-ID | <a4620743-4932-48aa-ac21-f7c279b6bb5e@googlegroups.com> |
| In reply to | #10394 |
Sorry, but i have a strange problem: When compile the exe, all groups appear 'NIL', some clue? Everything works in debug mode. :( Paulo
[toc] | [prev] | [next] | [standalone]
| From | Paulo Oliveira <paulofvoliveira@gmail.com> |
|---|---|
| Date | 2017-04-06 15:06 -0700 |
| Message-ID | <eea54f7f-15b1-4ee9-aaef-ef659efdf15c@googlegroups.com> |
| In reply to | #10395 |
quinta-feira, 6 de Abril de 2017 às 22:52:37 UTC+1, Paulo Oliveira escreveu: > Sorry, but i have a strange problem: > > When compile the exe, all groups appear 'NIL', some clue? Everything works in debug mode. :( > > Paulo Solved, Forcing the link of the function, works... SumCampo(NULL_OBJECT,NULL_STRING,NULL_OBJECT) Paulo
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web