I've chart report which uses the parameter of Type Java.util.collection. When I try to use this chart at group band as subreport to the Main report with similar parameter of Type Java.util.collection, the chart value keep iterates within the group. For example, if the chart shows the value for L1 & L2 in two separate page. But when added to the Main report for the value L1, the subreport displays both L1 & L2 rather than just L1.
Could I able to display just L1 from subreport when the parameter is passed as L1, not both L& L2 in the group band?
FYI, using Jaspersoft Studio 5.6.1
EDIT:
Suppose I am passing 2 Projects P1 and P2 as parameters from main report, the result now I am getting is:
1st page Main report data P1
Sub report data P1
Sub report data P2
2nd page Main report Data P2
Sub report data P1
Sub report data P2
But, the desired result should be like this:
1st page Main report data P1
Sub report data P1
2nd page Main report Data P2
Sub report data P2.
I've added the subreport in one of the Group header.
Main Report:
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test_subreport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d2616041-39f3-44ce-a1e4-4ce5a6a1593c">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Dev DB Conn" />
<parameter name="param_project" class="java.util.collection" nestedType="java.lang.Integer">
<parameterDescription>
<![CDATA[]]>
</parameterDescription>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT
i.id prid,c.INUSAGE,d.CURRUSAGE
FROM
project table i, custom table c
where i.id = c.id and $X{IN,I.id,param_project}
]]>
</queryString>
<field name="prid" class="java.math.BigDecimal" />
<field name="INUSAGE" class="java.math.BigDecimal" />
<field name="CURRUSAGE" class="java.math.BigDecimal" />
<group name="Group1">
<groupExpression>
<![CDATA[$F{INVID}]]>
</groupExpression>
</group>
<columnHeader>
<band height="210">
<textField>
<reportElement x="0" y="80" width="80" height="30" uuid="263d8d17-1c40-4709-ba8f-76e27a976c75" />
<textFieldExpression>
<![CDATA[$F{prid}]]>
</textFieldExpression>
</textField>
<subreport>
<reportElement isPrintRepeatedValues="false" x="80" y="2" width="200" height="200" uuid="da630714-b937-493c-9db5-a4baa7128f3d" />
<subreportParameter name="param_invID">
<subreportParameterExpression>
<![CDATA[$P{param_project}]]>
</subreportParameterExpression>
</subreportParameter>
<connectionExpression>
<![CDATA[$P{REPORT_CONNECTION}]]>
</connectionExpression>
<subreportExpression>
<![CDATA["Workload1_added_collection_group1.jasper"]]>
</subreportExpression>
</subreport>
</band>
</columnHeader>
Subreport link: subreport
Thanks
Sreeram
Usually the subreport should only get the item it should display, e.g. "P1 ID" for P1 and "P2 ID" for P2. But if you provide a collection it will always cycle through the collection of data.
So you should add either the ID to the subreport or put the chart in the main report.
Related
I'm trying to rewrite the following cts query using XML structure query:
cts:element-pair-geospatial-query(
fn:QName("http://www.example.com/2009/foo","wgs84"),
fn:QName("http://www.example.com/2009/foo","latitude"),
fn:QName("http://www.example.com/2009/foo","longitude"),
cts:circle("#12 53.411541,-2.9900994"),
("coordinate-system=wgs84","score-function=reciprocal","slope-factor=4"),
32
)
I converted it into:
<geo-elem-pair-query>
<parent ns="http://www.example.com/2009/foo" name="wgs84" />
<lat ns="http://www.example.com/2009/foo" name="latitude" />
<lon ns="http://www.example.com/2009/foo" name="longitude" />
<fragment-scope>documents</fragment-scope>
<geo-option>coordinate-system=wgs84</geo-option>
<geo-option>score-function=reciprocal</geo-option>
<geo-option>slope-factor=4</geo-option>
<circle>
<radius>12.0</radius>
<point>
<latitude>53.411541</latitude>
<longitude>-2.9900994</longitude>
</point>
</circle>
</geo-elem-pair-query>
Unfortunately, I don't know how to add weight into <geo-elem-pair-query>. Accordingly to MarkLogic documentation it seems to be unsupported (but cts equivalent supports it). I've tried to add <weight>32.0</weight> but it doesn't work.
Do you know if there is a way to add weight to geo-elem-pair-query structure query?
I have various XML files with information as shown below. Im having difficulty parsing this variable XML format into a dataframe that can handle both differing numbers of metrics and duplicated properties tags.
<ProducedFruits>
<FruitType>
<FruitName>Apple</FruitName>
<FruitMetrics>
<Properties Sugars="27.51" Rate="5.03" />
<Properties Sugars="219.39" Rate="12.19" />
<Properties Sugars="266.34" Rate="75.9" />
</FruitMetrics>
</FruitType>
<FruitType>
<FruitName>Lime</FruitName>
<FruitMetrics>
<Properties Sugars="1884.2" Rate="5" />
<Properties Sugars="1884.2" Rate="98.3" />
</FruitMetrics>
</FruitType>
<FruitType>
<FruitName>Lemon</FruitName>
<FruitMetrics>
<Properties Sugars="1064.77" Rate="5" />
<Properties Sugars="1064.77" Rate="56" />
</FruitMetrics>
</FruitType>
<FruitType>
<FruitName>Banana</FruitName>
<FruitMetrics>
<Properties Sugars="113" Rate="12" />
<Properties Sugars="113" Rate="79" />
</FruitMetrics>
</FruitType>
</ProducedFruits>
Each file may be somewhat different, so ideally i would to create something that can handle the inconsistent number of values that also preserves the fruitname and creates a dataframe like the one at the bottom.
enter image description here
To pass your xml into R as a dataframe you can use the XML package (https://cran.r-project.org/web/packages/XML/), e.g. data <- XML::xmlParse("doc.xml") then bind lists together with xml_data <- XML::xmlToList(data) then xml_df <- as.data.frame(xml_data) (per: How to parse XML to R data frame)
How to set-up a model in icCube to allow to drill down to the details, when details contain text fields?
The idea is to get a list, with column names containing the text fields (in combination with amount fields). Just like a simple SQL statement would give.
I have tried the following:
a) added a technical dimension that is linked to the rows (via rownumber) and added MIN Aggregation for the text fields. With the idea to use these when a DRILLTHROUGH MDX statement is invoked. The DRILLTHROUGH function works, but does not give the values next to each other for the measures. Result is like:
b) added each unique line a line number and loaded the line number as lowest detail in one of the dimensions. Added attributes for these text and date items for the "drillthrough" columns. Next, added calculated measures to get the property for these attributes. The drillthrough is now effectively a drillby to the lowest details. It works, but this is not nice as it blows up my dimension.
c) tried to use the widget data source SQL, but it is not available for text files, and it does not work for MSAccess files (too slow).
The preferable solution should works in the dashboards and in any XMLA/REST API interface.
Enclosed this example
the schema file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="7">
<schemaDefinition name="drilltrhough-text" description="" group="Issues" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>true</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="data">
<memoryDataTable tableName="data" rowLimit="-1" id="d9429713-9be8-4c63-9b40-4a20388e7563">
<column name="dimension" tableType="STRING" type="STRING" selected="true" primaryKey="false"/>
<column name="amount" tableType="STRING" type="STRING" selected="true" primaryKey="false"/>
<column name="text" tableType="STRING" type="STRING" selected="true" primaryKey="false"/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>,</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>dimension, amount, text
a, 10,some text
b, 20, some more text
c, ,text without an amount</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="d9429713-9be8-4c63-9b40-4a20388e7563" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="86d118f0-71ba-4826-a6ac-343eac96fb05" name="Dimension">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Dimension" isDefault="true">
<level name="Dimension - L" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="dimension"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<cube id="caa9c520-f953-4c77-9e72-76c8668170f7" name="Cube">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="d9429713-9be8-4c63-9b40-4a20388e7563" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="Amount" aggregationType="SUM">
<dataColumn name="amount"/>
</measure>
<measure name="Text" aggregationType="MIN">
<dataColumn name="text"/>
</measure>
<links dimensionId="86d118f0-71ba-4826-a6ac-343eac96fb05">
<viewLinks type="LAST_LEVEL">
<toColumns name="dimension"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
</schemaDefinition>
</schemaFactory>
- the mdx
drillthrough
select [Measures].members on 0
, [Dimension].[Dimension].[Dimension - L] on 1
from [cube]
return Name([Dimension])
the result
This is not related to having a measure of type STRING.
You're performing a multi-cell result drillthrough (which is an extension of standard MDX in icCube). In that case, the result is "organized" per result cell meaning each [Measures] being in its own category (you can add another Amount measure and you'll see the same behavior).
Instead you should perform a single cell drillthrough:
drillthrough
select [Dimension].[Dimension].[Dimension -L].[a] on 0
from [cube]
And the result should look like:
You can see the [Measures].[Info] being on the same row (as all the other measures).
Hope that helps.
Using a BizTalk Map and wondering if there's a good way to do the following.
I need to map a received Invoice to a list of Orders. However each Order must contain only two line items (let's assume the Invoice has an even number).
This means that Invoice(1, 2, 3, 4) should map to Orders(Order (1, 2), Order (3, 4)).
Essentially, I need to create new parent elements when (index % 2 == 0).
Is there a functoid-only way of doing this?
XML example below:
<Invoice>
<Client>Client1</Client>
<Line>
<Code>1</Code>
<Price>$1.00</Price>
<Qty>1</Qty>
</Line>
<Line>
<Code>2</Code>
<Price>$2.00</Price>
<Qty>2</Qty>
</Line>
<Line>
<Code>3</Code>
<Price>$3.00</Price>
<Qty>3</Qty>
</Line>
<Line>
<Code>4</Code>
<Price>$4.00</Price>
<Qty>4</Qty>
</Line>
</Invoice>
to
<Orders>
<Order>
<Client>Client1</Client>
<OrderItem>
<Code>1</Code>
<Qty>1</Qty>
</OrderItem>
<OrderItem>
<Code>2</Code>
<Qty>2</Qty>
</OrderItem>
</Order>
<Order>
<Client>Client1</Client>
<OrderItem>
<Code>3</Code>
<Qty>3</Qty>
</OrderItem>
<OrderItem>
<Code>4</Code>
<Qty>4</Qty>
</OrderItem>
</Order>
</Orders>
What I've tried:
Standard mapping: A single Order with all lines, as expected
Value Mapping to Client based on index % 2: Order per line (half have Client)
Table Looping (Gated to index % 2) + Extractor to Client: Order per line, only half lines
What I'm likely to end up doing:
XSLT
Or, C# manipulation after mapping
In the advanced functoids section of the toolbox look for the 'index' functoid.
Add a scripting functoid on the output.
Add C# code to check for the indexes you want to match.
You can switch output on and off by returning a boolean from the scripting functoid.
Format consist of lines, every line has set of key="value" elements.
Format example:
X="1" Y="2" Z="who are you?"
Y="4" Z="bla bla..."
X="42"
I would like to import this data into R, table or data.frame, where key defines column.
The following code parses the file you provided in a 'melted' form:
data<-NULL
stream<-file("path");open(stream) #or stream<- textConnection(' X="1" Y="2" Z="who are you?" Y="4" Z="bla bla..." X="42"')
while(length(ele<-c(scan(stream,what="string",n=1,sep="="),scan(stream,what="string",n=1,sep=" ")))>0){
data<-rbind(data,ele);
}
close(stream);
print(data);
Now crystallizing:
sapply(unique(data[,1]),function(key) data[data[,1]==key,2])