Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Calling a DataSet via script and display the results in the same script.
mikaru
<p><span><span>Hi everyone</span><span>,</span> <span>I express my</span> <span>question.</span>
<span>First</span> <span>let me explain</span> <span>where I am</span><span>, I have a</span> <span>DataSet</span> <span>that</span> <span>first</span> <span>appoint</span> <span>Query1</span> <span>whose</span> <span>results are displayed</span> <span>in a table</span> <span>but through</span> <span>the script of a</span> <span>dynamic</span> <span>text</span><span>.</span> <span>What I</span> <span>mean</span> <span>is that</span> <span>based on a value</span> <span>of a specific</span> <span>field in a</span> <span>result row</span> <span>I change the</span> <span>CSS</span> <span>display</span><span>.</span> <span>What I</span> <span>want to do is</span> <span>based on a value</span> <span>in</span> <span>a field</span> <span>(eg</span> <span>Name</span> <span>= '</span><span>Smith'</span><span>)</span> <span>I call a</span> <span>DataSet</span> <span>Query 2</span> <span>passing</span> <span>as parameter '</span><span>Dupont</span><span>' and then</span> <span>display the results in</span> <span>the</span> <span>same</span> <span>script.</span> <span>So basically</span> <span>look like this:</span>
<span>Line 1</span> <span>Query 1</span>
<span>Line 2</span> <span>Query 1</span>
<span>Line 3</span> <span>Query 1</span> <span>(</span><span>Name</span> <span>= '</span><span>Smith'</span><span>)</span> <span>I call</span> <span>the query</span> <span>2</span>
<span>Display Line</span> <span>1 of the application</span> <span>2</span>
<span>Display Line</span> <span>2 of the application</span> <span>2</span>
<span>Display Line</span> <span>3 of the application</span> <span>2</span>
<span>Line 4</span> <span>Query 1</span>
<span>Line 5</span> <span>Query 1</span>
<span>etc ...</span>
<span>If possible</span> <span>can you tell</span> <span>me</span> <span>the method to execute</span> <span>/</span> <span>call</span> <span>to do this.</span>
<span>Thank you</span> <span>and good afternoon.</span></span></p>
Find more posts tagged with
Comments
micajblock
<p>If performance is not an issue then nested tables is the easiest way to do this. There are examples in DevShare.</p>
mikaru
<p>Where are this examples please ? i don't find.</p><p>Thank you for your advice.</p>
micajblock
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/devshare/_/designing-birt-reports/530-sample-birt-sub-report-example'>http://developer.actuate.com/community/devshare/_/designing-birt-reports/530-sample-birt-sub-report-example</a></p>
;
mikaru
<p>Thank.</p><p>I have a question , i can launch the second query or table if for example row["code_champ"]=='Country" , or in nested table the second table is launched for all values of row["code_champ"] ?</p><p>I want specifie when launch the second query like my example.</p>
micajblock
<p>Again, if performance is not an issue. Set the visibility of the inner tables based on your condition. Another option is use joined data sets. One for the main query and the second for the nested query. Filter the nested query on your condition and set the join to be an outer join.</p>
mikaru
<p>Okay! ,<span><span>I'll try</span> <span>I</span> <span>understood.</span></span></p><p><span><span>Thanks.</span></span></p>
mikaru
<p><span><span>Hello,</span> <span>I tried the</span> <span>nested table</span> <span>but it</span> <span>appears</span> <span>to me that</span> <span>result is</span> <span>to say</span> <span>that</span> <span>I have</span> <span>made</span> <span>​​my position</span> <span>on the "</span><span>dataset</span> <span>parameter</span> <span>binding"</span> <span>So</span> <span>I get</span> <span>out the</span> <span>field whose</span> <span>I need</span> <span>except that</span> <span>if</span> <span>there is a</span> <span>";"</span> <span>I want to do</span> <span>a</span> <span>split</span> <span>on</span> <span>the answer</span> <span>to be able to</span> <span>run</span> <span>2</span> <span>times in a row</span> <span>the request of the</span> <span>nested table</span><span>.</span>
<span>example:</span>
<span>if (</span><span>row [</span><span>"</span><span>CODE_CHAMP</span><span>"]</span> <span>== '</span><span>LISTEPAYS</span><span>')</span>
<span>{</span>
<span>d =</span> <span>row </span> <span>split</span><span>.</span> <span>(';</span><span>');</span>
<span>for (</span><span>i = 0;</span> <span>i <</span><span>d.lenght</span> <span>i</span> <span>+</span> <span>+)</span>
<span>{</span>
<span>d [</span><span>i</span><span>]</span><span>;</span>
<span>}</span>
<span>}</span>
<span>This is my</span> <span>condition in the</span> <span>dataset</span> <span>parameter</span> <span>binding</span><span>.</span>
<span>I want</span> <span>that if</span> <span>row = '</span><span>FRANCE</span><span>,</span> <span>SPAIN</span><span>'</span> <span>that</span> <span>displays</span> <span>the query</span> <span>is done</span> <span>for the value</span> <span>France</span> <span>and</span> <span>Spain</span> <span>but this</span> <span>value</span> <span>appears</span> <span>to me that</span> <span>the result for the</span> <span>value</span> <span>France</span><span>.</span>
<span>Will</span> <span>he has a</span> <span>way to display</span> <span>two or more results</span><span>?</span></span></p><p> </p><p><span><span>Thank you.</span></span></p>
micajblock
<p>Do you have sample data that we can play with?</p>
mikaru
<p>No , unfortunately
</p>
micajblock
<p>You will need to write some script I think to create a In clause. Again if you create sample data (even dummy data) that illustrates what your data looks like, I could build an example. </p>
mikaru
<p>I don't arrive make my database Mysql localhost in BIRT data source.</p>
micajblock
<p>Create a dummy CSV file the demonstrates what your data looks like.</p>
mikaru
<p>I have a file CSV but i don't where we create a datasource with a file slq, csv or other.</p><p>I send file CSV , it's just a example ,That looks like a little the truth datum.</p><p> </p><p>Requete1 : SELECT * FROM produit where produit='VOY1'.</p><p>My condition :if(row=='LISTEPAYS')</p><p>{</p><p>d=row.split(';');</p><p>// normaly d[0]==France and d[1]==ESPAGNE</p><p>// and here i launch second query with parameter d[0] in first and d[1] in second etc</p><p>}</p><p> </p><p>SQL because i dont upload :</p><p> </p><p> </p><p>-- phpMyAdmin SQL Dump
-- version 3.3.5
-- <a data-ipb='nomediaparse' href='
http://www.phpmyadmin.net'>http://www.phpmyadmin.net</a>
;
--
-- Serveur: 127.0.0.1
-- Généré le : Lun 14 Avril 2014 à 15:53
-- Version du serveur: 5.1.49
-- Version de PHP: 5.3.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET
@CHARACTER_SET_CLIENT
*/;
/*!40101 SET
@CHARACTER_SET_RESULTS
*/;
/*!40101 SET
@COLLATION_CONNECTION
*/;
/*!40101 SET NAMES utf8 */;
--
-- Base de données: `test`
--
--
--
-- Structure de la table `champs`
--
CREATE TABLE IF NOT EXISTS `champs` (
`champs` varchar(64) NOT NULL,
`libelle` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Contenu de la table `champs`
--
INSERT INTO `champs` (`champs`, `libelle`) VALUES
('CAPITAL', ''),
('POPULATION', ''),
('LISTEPAYS', '');
--
--
-- Structure de la table `produit`
--
CREATE TABLE IF NOT EXISTS `produit` (
`produit` varchar(64) NOT NULL,
`champs` varchar(64) NOT NULL,
`titre` varchar(64) NOT NULL,
`paragraphe` varchar(64) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Contenu de la table `produit`
--
INSERT INTO `produit` (`produit`, `champs`, `titre`, `paragraphe`) VALUES
('FRANCE', 'CAPITAL', 'CAPITAL', 'PARIS'),
('ESPAGNE', 'CAPITAL', 'CAPITAL', 'MADRID'),
('FRANCE', 'POPULATION', 'POPULATION', '1millions'),
('ESPAGNE', 'POPULATION', 'POPULATION', '2millions'),
('VOY1', 'LISTEPAYS', 'LISTEPAYS', 'FRANCE;ESPAGNE');
</p>
micajblock
<p>Where is the CSV file?</p>
mikaru
<p>My second query is :</p><p> </p><p>SELECT * from produit where produit='FRANCE' (d[0])</p>
mikaru
<p>The CSV file not want uploader</p><p>The message error is :</p><p>You aren't permitted to upload this kind of file.</p>
micajblock
<p>What version of BIRT are you using?</p>
mikaru
<p>v3.7.1</p>
micajblock
<p>Attached is a sample. Hope this helps.</p>