Jump to content
We've recently updated our Privacy Statement, available here ×

garry_3

Members
  • Posts

    2
  • Joined

  • Last visited

garry_3's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. The documentaion on XML datasources says: A simplified example of the data is as follows: <data> <meta> <unrelated> <id>18</id> <description>description</description> <year>2014</year> <code>2014GBN</code> </unrelated> <different> <id>3</id> <label>My label</label> </different> </meta> <person> <id>1308</id> <code>Amj/3177</code> <surname>Amj</surname> <firstname>Jbswjt</firstname> <middlename>Pbvm</middlename> <gender>m</gender> ..... <username>jbswjt/bmj</username> <parent_node> <id>1467</id> <title>A title</title> <priority>99</priority> <code>09EN</subject_code> <id>109</subject_id> <description>English</subject_description> <department_code>6</subject_department_code> <node> <id>39480</id> <template_id>1</template_id> <different_id>3</different_id> <unrelated_id>18</unrelatedid> .... </node> </parent_node> <parent_node> .... <node> .... </node> </parent_node> </person></data>[/code]How do you reference an element that is in an "unrelated" node? i.e. how do I reference /data/meta/unrelated/code from node ? The datasource for the subreport is: <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("person[id]/parent_node/node")]]></dataSourceExpression>[/code]Any assistance would be greatly appreciated.
  2. First newbie question ... 3 days in and still grappling with some of the fundamentals .... have searched extensively but have not been able to find what I'm looking for .... hopefully I'm able to articulate what I want in a way that can be understood ..... How do I set a variable in the report that returns the <id> element from an ancestor node in an an XML data source, the selection based on the node with the most recent <date> field in the ancestor node? A simplified example of my data source is as follows: <data> <meta> <term> <code><![CDATA[TERM1]]></code> <year><![CDATA[2017]]></year> <start><![CDATA[2017-02-01]]></start> <description><![CDATA[FIRST TERM DESCRIPTION]]></description> <end><![CDATA[2017-06-30]]></end> <id><![CDATA[7]]></id> </term> <term> <code><![CDATA[TERM2]]></code> <year><![CDATA[2017]]></year> <start><![CDATA[2017-07-17]]></start> <description><![CDATA[NEXT TERM DESCRIPTION]]></description> <end><![CDATA[2017-12-08]]></end> <id><![CDATA[9]]></id> </term> ...... </meta> <student> <id><![CDATA[1187]]></id> <code><![CDATA[POTTH19]]></code> <surname><![CDATA[Potter]]></surname> <firstname><![CDATA[Harry]]></firstname> .... <node> <id><![CDATA[1346]]></id> <title><![CDATA[Potions]]></title> ..... <childNode> <id><![CDATA[54313]]></id> <template_id><![CDATA[10]]></template_id> <type_id><![CDATA[1]]></type_id> <term_id><![CDATA[7]]></term_id> .... </childNode> </node> <node> <id><![CDATA[1367]]></id> <title><![CDATA[History of Magic]]></title> .... <childNode> <id><![CDATA[54453]]></id> <template_id><![CDATA[10]]></template_id> <type_id><![CDATA[1]]></type_id> <term_id><![CDATA[7]]></term_id> .... </childNode> </node> ....... <node> <id><![CDATA[1462]]></id> <title><![CDATA[Potions]]></title> ..... <childNode> <id><![CDATA[54313]]></id> <template_id><![CDATA[10]]></template_id> <type_id><![CDATA[1]]></type_id> <term_id><![CDATA[9]]></term_id> .... </childNode> </node> <node> <id><![CDATA[1679]]></id> <title><![CDATA[History of Magic]]></title> .... <childNode> <id><![CDATA[54453]]></id> <template_id><![CDATA[10]]></template_id> <type_id><![CDATA[1]]></type_id> <term_id><![CDATA[9]]></term_id> .... </childNode> </node> </student> <student> ..... </student> <student> ..... </student> <student> ..... </student> <student> ..... </student>[/code]The root node of the report is /data/student. Elements at node/childNode/term_id reference /data/meta/term/id. How do I set a variable "thisTerm" with the value "9" {TERM2 <id>} based on the fact that "TERM2" <end> is greater that "TERM1" <end>? The idea is that subreports will present child/Node data differnetly based on which term it belongs to .... Not a developer so also new to the syntax - have never dealt with Java, JavaScript or Groovy .... Any assistance would be greatly appreciated.
×
×
  • Create New...