Using Crystal Reports 10 and vb6/classic (although I expect its the same in any language),
is it possible to change a suppression formula on a Group header section dynamically from code.
I'm basically changing the GroupConditionField on a specific group dynamically according to user input, but on that group header there is a suppression field formula containing a check on a grouped sum.
Sum ({#ColourTotal}, {Table.Field}) =0
If this is true, the group gets suppressed. This obviously comes up with an error complaining it can't find the group when the GroupConditionField is changed through code.
So is there a way to change the suppress formula for a specific group from within code?
I apologize this is C# but I had it handy. I need to so something similar so I have a formula that I set to a value from my program. The report checks this value to decide whether to suppress or not. I suspect you can use the same technique to change the formula, but I'm too lazy to test it my self.
report.DataDefinition.FormulaFields["Florida"].Text = (Convert.ToBoolean(option.EffectiveValue) == true ? "1" : "0");
This code just sets the formula field, "Florida" to either 0 or 1.
I believe I have found a way to do it using the Group Selection Formula under
Report->Selection Formulas-> Group inside the actual report.
Not ideal and will involve some reformatting but should work.
Related
I am currently trying to work out how to make the current Google Sheets version of COUNTIF properly count how many times the value of a cell (C3) is higher than the value if another cell (E3), according to the following formula:
=COUNTIF('4'!$C$3,">'4'!$E$3")
You'll note that the formula is run in a different tab than the one where the cells being counted are located in (which is named "4"). The formula returns a zero '0', when it should be returning a one '1', as the value in '4'!$C$3 actually is higher than the value in '4'!$E$3.
Clearly, I am doing something wrong.
So, the user I'-'I (stackoverflow.com/users/8404453/i-i) suggested the following edit:
=COUNTIF('4'!$C$3,">'4'!$E$3") --> COUNTIF('4'!$C$3,">"&'4'!$E$3)
This suggestion resolved my issue.
Im new to Report Builder and having issues with some expressions that Im trying to implement in a report. I got the standard ones to work however as soon as I try any distinctions, I get error messages. Over the last couple weeks, Ive tried many combinations, read the expression help, google and looking at other questions at internet sites. To reduce my frustrations, I even would jump to other expressions and walk away hoping I would have different insight coming back.
Its probably something simple or something I dont know about writing expressions.
Im hoping that someone can help with these expressions; they are the versions I get the least errors with(usually just expression expected) and show what Im trying to accomplish.
=IIF((Fields!RECORDFLAG.Value)='D',COUNTDISTINCT(Fields!TICKETNUM.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and (Fields!RECORDFLAG.VALUE)='A' or
'B',SUM(Fields!DOLLARS.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and
(Fields!RECORDFLAG.VALUE)='P',SUM(Fields!DOLLARS.Value),0)
=Sum([DOLLARS] case when [RECORDFLAG]='P' then -1*[DOLLARS])
Thank You.
=IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICKETNUM.Value))
The error message gives you the answer here - no false part of the iif() has been specified. Use =IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICKETNUM.Value), 0)
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE)="A" or "B",SUM(Fields!DOLLARS.Value),0)
This is not how an OR works in SSRS. Use:
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE="A" or Fields!RECORDFLAG.Value = "B"),SUM(Fields!DOLLARS.Value),0)
The 0s are returned due to your report design. countdistinct() is an aggregate function - it's meant to be used on a set of data. However, your iif() is only testing on a per row basis - you're basically saying "if the current row is thing, count all the distinct values" which doesn't make sense. There are a couple of ways forward:
You can count the number of times a certain value occurs in a given condition using a sum(). This is not the same as the countdistinct(), but if you use =sum(iif(Fields!RECORDFLAG.Value = "D", 1, 0)) then you will get the number of times RECORDFLAG is D in that set. Note: this requires the data to be aggregated (so in SSRS, grouped in a tablix).
You can use custom code to count distinct values in a set. See https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/. You can apply this even if you have only one dataset - just reference the same one twice.
You can change the way your report works. You can group on Fields!RECORDFLAG.Value and filter the group to where Fields!RECORDFLAG.Value = "D". Then in your textbox, use =countdistinct(Fields!TICKETNUM.Value) to get the distinct values for TICKETNUM when RECORDFLAG is D.
What I am currently trying to do in BIRT 4.5 is repeat only a specific part of my tables header. However when I set it to repeat the header it always repeats the entire header.
Is there a way to only repeat a specific part of the header?
In my example - there is two headers, the "table name" and the "column headings". I only want the column headings to repeat. I have a feeling its likely going to be a scripted fix, but have no idea where to go to start it.
this might get tricky because headers can be repeated for groups but also for pagebreaks.
Not the most fancy, but you should get something working by defining a global variable on the page script
var headerCount = 0;
Then select an element in the header, open the onPrepare script and have it increment the counter:
headerCount = headerCount + 1;
with this information, you can make true/false statements in the visibility property.
Each object has onPrepare, onCreate, onRender and onPagebreak scripts. Not sure what the exact difference, so you have to experiment a bit with this. (because when an element should increase the counter, but is not rendered due to the visibility clause, you can get unexpected results.)
Good luck!
When setting repeated content in a section in Orbeon each control is repeated and the their names are the same. How do I access the the control from the first, second...etc instance of a control from each iterated section? I'm thinking along the lines of $control-name[instance#] or something similair.
The following works, given this form:
$name[2]: return the second value
string-join($name, ', '): join all values with commas
count($name): return the number of values
See also the relevant documentation.
To access this value in "bind" section, you can use a relative path , like ../name=''.
TO access this value in "body" section, then you can use context()/../name.
If you are trying to make anything different, be more specific and this answer can be edited to be according to what you want.
Let's say I have a value that is passed to a process. What activity should i use to compare this value with another?
I know it may seem a foolish question, but i am new to this.
Assuming you are talking about BusinessWorks, comparing text values of XML attributes or elements is done with XPath using the '=' sign. You don't need to use any specific activity to do so. This can actually be done on any branch (with the "Success with condition" switch) or on the input tab of any activity.
For instance, if you want to compare the text values of 2 elements, you can use an XPath formula like this:
$Start/root/myString1 = $Start/root/myString2
This formula returns true if myString1 and myString2 have the same text value, false otherwise.
Then you can, for example, use this formula as a test condition for an "If" or a "Choice" statement on an input tab of any activity.