Split the lines of record in crystal report? - crystal-reports

I have below data in my report footer b section.
Container No
12344, ABC12341234, BNMKLO00, CAIU86284560, CAIU8628757,
DEF34190000, DES23457, DF3134, DF347900, DFRT56990,
DSE234661, FGR450000, GHM890000, KLM1230992, KLO900123,
PLO67799, QSAW12345, QWE123456, RT56000, RT560012WE,
SAW12344, SDQ123456789, TYHYH667000, TYT5612334,
VBGT6787900, VFR3400001, WHLU1234, WHLU5420938,
WHLU5581193, WQR6790000, XCDER40000
This containerNo list display in one field as well as I do in sql statement.
I want to display the maximum line of records as long as it was fit until to bottom of page, then the remainder line of records will be continue on the next page.
So, the output should be like:
--Page 1 of 2
Container No
12344, ABC12341234, BNMKLO00, CAIU86284560, CAIU8628757,
DEF34190000, DES23457, DF3134, DF347900, DFRT56990,
DSE234661, FGR450000, GHM890000, KLM1230992, KLO900123,
PLO67799, QSAW12345, QWE123456, RT56000, RT560012WE,
SAW12344, SDQ123456789, TYHYH667000, TYT5612334,
--Page 2 of 2
Container No
VBGT6787900, VFR3400001, WHLU1234, WHLU5420938,
WHLU5581193, WQR6790000, XCDER40000
How can I do that without using a sub-report and group?

Related

Count total rows excluding children rows

I have a requirement for display only row count of parent rows in tree data mode. I am using getDisplayedRowCount api it gives me all the row count i.e parent + child (if expanded). Is there any way to do it?
For example
If we have rows like below where 2 row has child and 1 row has no child then just count as 3 . dont count children. Just count parent row and row without children
Result count : 3 of 3
Parent row 1
--- Child row
Parent row 2
--- child row
Row without child
For example, if we have tree structure like in the example . How to only count A, C and E? and show count as 3 on top of grid
https://www.ag-grid.com/example-runner/grid-react.php?section=javascript-grid-tree-data&example=filler-nodes&generated=1&clientside=1&rowgrouping=1&enterprise=1&grid=%7B%22noStyle%22%3A0%2C%22height%22%3A%22100%25%22%2C%22width%22%3A%22100%25%22%2C%22enterprise%22%3Atrue%7D
https://www.ag-grid.com/javascript-grid-tree-data/
One possible solution would be to rely on the fact that the parent node of the nodes A, C & E (in your given example) is the root node - note that this is not documented in the official documentation, however it is the simplest solution I can think of.
If a node has the root node as the parent, then we can call it a parent node.
You can verify this by adding this code and look at the nodes which are printed:
gridOptions.api.forEachNode((node) => {
if (node.parent.id == 'ROOT_NODE_ID') {
console.log(node.key);
}
});
I've put together an example showing this at the click of a button

Suppress a Text Object Based on Field Value in Object

I have a Text Object that contains a text string followed by a database field Max Weight {table.field}
I want to suppress all of the Text Object whenever {table.field} = 0.
I tried the following formula under Format Text > Common > Suppress
if {table.field} = 0 then true else false
What I get is the field value within the text object either on or off while the text is always suppressed. What do I need to do to make this work? Thanks.
You can try 2 different solutions:
1) Keeping your Max Weight label, create a new Formula in the 'Formula Fields' then enter this code:
if {table.field} = 0 then '' else ToText({table.field})
2) Supressing all text, you have to create a new Formula too, but type this:
if {table.field} = 0 then '' else 'Max Weight ' + ToText({table.field})
This second way, you will create a label that will only appears when your conditions happens, and you must replace the old TextObject with this new Formula. This will cause a blank area, because no text and no weight will show, but it looks like exactly what you need.
I just tested here and it's working. Note that both 'spaces' are in the document. Attached is an image that may help you find the formulas section. Hope you can use it.

How to change background color for each two rows in SSRS in a group

How can I write the expression in order to change background color for each two rows in SSRS?
I need something like that:
I tried expression
=IIF(Fields!Type.Value="2016 Submitted" , "LightBlue",
IIF(Fields!Type.Value="2015 Submitted" , "LightBlue",
Nothing))
But because some months dont have values it looks like this:
If I try this expression I get below:
=IIF(RunningValue(Fields!Count.Value, CountDistinct, Nothing) MOD 2 = 1, "White", "PaleTurquoise")
Dance-Henry I tried your code
=IIF(RowNumber(Nothing) Mod 4 = 1 or RowNumber(Nothing) Mod 4 = 2, "Aqua","White")
and this is what i got:
You can select the row in design pane and press F4 to setup property BackgroundColor as =IIF(RowNumber(Nothing) Mod 4 = 1 or RowNumber(Nothing) Mod 4 = 2, "Aqua","White")
Captures are attached. Do it accordingly.
RESULT is something like this
After going thru the link https://blogs.msdn.microsoft.com/chrishays/2004/08/30/green-bar-matrix/
Tested and it works well for the Green Bar Effect for Matrix. I will show it step by step here as for later reference.
Step 1: Create the Matrix and add one more column under the innermost row grouping in your matrix. (ColorNameTextbox here)
Step 2: Select the textbox of ColorNameTextbox and press F4 to setup BackgroundColor property as =Value shown below.
Step 3: Select the textbox of Matrix cell and press F4 to setup BackgroundColor property as =ReportItems!ColorNameTextbox.Value shown below.
Step 4: Drag the inner grouping header (ColorNameTextbox) to be as narrow as possible.
Step 5: Preview Pane to check the result.
If you could add a hidden color_group column and populate it with a new number at each point you want to change the color (in your case 1,1,2,2,3,3,4,4) then you could use something like the following (which works for varying size groups):
IIF(RunningValue(Fields!color_group.Value, CountDistinct, Nothing) MOD 2 = 1, "White", "PaleTurquoise")
I had a similar problem where I could not come up with alternating rows because my data has Column Groups that were the RowNumber(Nothing) method to fail. Learning from all the other posts here this is how I resolved it in steps.
I added the following code into the report properties, that provides a function to get the row number, each time it is called. The function increments the row count each time it is called. >>Right click space around the report >> Properties >> Code. Alternatively go to Code Properties Window, when the report is selected.
Add the following lines:
Public Row_Sum As Decimal = 0
Public Function Lookup_Sum( ) As integer
Row_Sum = Row_Sum + 1
Return Row_Sum
End Function
I added a new column at the beginning of the rows called No. that would calculate and show the row number.Right click the first column >>Insert Column>>Inside Group-Left.
On the expression for the new report add this line of code. Also take a note of the name of the TextBox that will have the No. Value. It will be needed in the next step. In my case the TextBox is called TextBox6 (Properties Window). >>Right Click Cell>>Expression.
Add the code:
=Code.Lookup_Sum()
I highlighted the entire row and went to the Background property and added the following expression to compute the row number.
Add the code(TextBox6 is the name Textbox name noted above):
=IIF(VAL(ReportItems!Textbox6.Value) MOD 2, "LIGHTBLUE", "WHITE")

how do I check UItableview rows are in correct oder using calabash

In side my calabash test feature,in the middle of the flow I add four known numbers like
xxxx1111
xxxx2222
xxxx4444
xxxx3333
one after another and this order.(something like a user saved his credit card numbers) and in the final view I show them in a UITableView each row contains a number which is like xxxxxx1111. This table view shows the numbers sorted according to the Oldest to Newest I want to verify it . How should I do it using calabash ?
I Tried this and it works for me now. I declare a step definition in _steps.rb file
Then /^I see cell label "([^"]*)" row num (\d+) in section (\d+)$/ do |cellLabel, row, section|
###### diff cells with labels in table, vertically orderd ######
## E.g. Then I see cell label "abc" row num 1 in section 0
res = query("label marked:'#{cellLabel}' parent tableViewCell indexPath:#{row},#{section}").empty?
if (res)
screenshot_and_raise "There is no cell label with text #{cellLabel} in indexpath #{row},#{section}"
end
end
and use it in calabash feature file like
Then I see cell label "xxxx1111" row num 0 in section 0
Then I see cell label "xxxx2222" row num 1 in section 0
Then I see cell label "xxxx4444" row num 2 in section 0
Then I see cell label "xxxx3333" row num 3 in section 0
Hope this will be useful to someone :)

Setting Alignment for each Element when more than one Element added to a PDFPcell

In a table, I have a few cells that contain multiple elements. For Example, to indicate address , the cell may contain a phrase containing an "ADDRESS:" header Chunk followed by another chunk containing the actual address:
FROM: -- Chunk 1 in Phrase
123 Main St, Some City, ST -- Chunk 2 in Phrase
As of now, to align the cell contents, I am using the following code in the PDFPcell:
cell.VerticalAlignment = Element.ALIGN_MIDDLE;
However, this aligns all of the cell contents to the middle of the cell. If I want to put Chunk 1 at TOP_LEFT and Chunk 2 at BOTTOM_LEFT, is it possible to achieve it with iTextSharp? Essentially, I am looking for a way to align various elements within a cell at different locations.
Unfortunately the only way to do what you want is to add a sub-table in place of your multiple chunks.
t.AddCell("Row 1");
PdfPTable subTable = new PdfPTable(1);
subTable.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
subTable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
subTable.AddCell("Top Align");
subTable.DefaultCell.VerticalAlignment = Element.ALIGN_BOTTOM;
subTable.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
subTable.AddCell("Bottom Align");
t.AddCell(subTable);
doc.Add(t);