c# - Crystal reports syntax error -
i tried make simple report using crystal reports dot net. returned wrong value “5” every time. correct value “3”. here result.
desktop desktop laptop laptop laptop total laptop 5
and below code have used.
local numbervar cnt := 0: local stringvar stv := {table_1.property}; local numbervar strlen := count({table_1.property}); local numbervar i; := 1 strlen ( if stv = “laptop” cnt := cnt + 1 else cnt := cnt + 0 ); cnt;
where wrong code? thanks:)
by assuming records printed in details section , formula total located in footer section, wrong result because in for
loop reading last record printed in details section since footer in being rendered after details section.
as solution can use 1 of following methods :
solution 2 formulas.
create formula called itemcountdetails , add following code.
whileprintingrecords; shared numbervar cnt; if recordnumber = 1 cnt:= 0; if {table_1.property} = "laptop" cnt:= cnt + 1;
drag , drop formula field somewhere on details section (where records printed) , suppress right clicking on field -> format object -> common tab -> , checking suppress checkbox.
create formula called itemcountfooter , add following code.
shared numbervar cnt;
drag , drop new formula field in footer section.
solution summary , grouping.
- right click inside section , select summary.
- from "choose field summarize" select "property" under table_1.
- from "calculate summary" select "count"
- click insert group , common tab select "property" first combobox.
- close dialogs clicking ok. on report see field name of group , field count.
- right click on groupheadersection1 bar , select suppress.
right click on "count of table_1.property" field -> format object -> common tab -> click x+2 button on right side of suppress checkbox , add following code there
if groupname({table_1.property}) <> "laptop" true else false
Comments
Post a Comment