Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Counting to variable then assigning
jfreak53
Ok now I do think I need some help ha ha, I spent all day yesterday trying to do this and couldn't get it.<br />
<br />
Ok, scenario. I have two datasets, two tables, one table nested inside the other table. This all works fine.<br />
<br />
In the second nested table from dataset number 2 I have two columns, each having it's own dynamic text. Right now each one does this, with different numbers of course:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if (row["Seo"] == "1") { this.value = "X"; }</pre>
<br />
And the second one reads == 2. Now, what I want is that inside this if statement that it adds +1 to a variable then at the very end assigns this variable to the dynamic text inside a column in table one. In other words if there are 12 X's for column == 1, then it adds up 12 and assigns this number as text to dynamic text in a column in table 1.<br />
<br />
Did this make sense? So, how is this done correctly? Where do I create the initial variable, and then do I assign to it like I would normal JS? Then how to I finally assign this variable to the text from table 1?<br />
<br />
I'm totally lost ha ha. Thanks.
Find more posts tagged with
Comments
mwilliams
Hi jfreak53,
So, you have an embedded table (table2), I'm assuming inside a group in table 1. You want to count the rows that meet a certain criteria within the embedded table and report that value out in table2? Is this correct?
Maybe you can explain your issue with a small sample of data in your next post or maybe you can create a similar setup to what you're wanting with the sample database and show what you're wanting where with that.
jfreak53
Yes you are correct in what I am looking for. I just want to bo able inside my if statements to add +1 to a variable and then at the end of all data assign that variable to the dynamic text in table 1. So yes your right.<br />
<br />
This is my SQL code for the dataset:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT
a .Codigo,
CONCAT(a .Nombres,' ',a .Apellidos) AS Nombres,
a .Seo,
ai.TipoInscripcion,
a.Retirado
FROM view_sc_alumnos_inscritos_reinscritos ai
INNER JOIN sc_alumno a
ON ai.IdSC_Alumno = a.IdSC_Alumno
INNER JOIN sc_seccion s
ON a.IdSC_Seccion_Actual = s.IdSC_Seccion
INNER JOIN sc_grado g
ON s.IdSC_Grado = g.IdSC_Grado
INNER JOIN sc_carrera c
ON g.IdSC_Carrera = c.IdSC_Carrera
INNER JOIN sc_jornada j
ON c.IdSC_Jornada = j.IdSC_Jornada
WHERE a.IdSC_Colegio = 1
AND a.FISICC = 0
AND a.Retirado = 0
AND c.IdSC_Carrera = 20
AND g.IdSC_Grado = 18
ORDER BY g.Orden, a.Apellidos, a.Nombres</pre>
<br />
The Seo column is the one that I am if statementing above. If it's 1 then X in column one, if it's two then X in column two. Both of these if statements work, so all I think I would need to do is assign to a variable and then assign that variable to the dynamic text of table 1. But how do I do that ha ha ha<br />
<br />
Thanks.
mwilliams
Check out the example attached. If you're using the run and render tasks separately, i.e. the web viewer, this works. If you use the preview mode or HTML, it won't. I just counted the rows on the inner table and stored the value in a persistentGlobalVariable. I then put a dummy dynamic text box in the group header of the outer table. Finally, in the onRender method of the dynamic text box, I recalled the global variable associated with that order.
Let me know if you have questions.
Report designed in 2.6.1
jfreak53
Sweet, thanks. I will give it a try right now.
jfreak53
This is the error that I am getting, what did I do wrong ha ha<br />
<br />
<blockquote class='ipsBlockquote' ><p>Errors in Report<br />
Line 1679: The value of the property "Value expression" is required.<br />
Line 1868: The value of the property "Value expression" is required.<br />
Line 1897: The value of the property "Value expression" is required.<br /></p></blockquote>
mwilliams
You need to put an expression in the dynamic text box.
" " should suffice. Or something like "this will be replaced by script" so you rememeber later.
jfreak53
Aha, so a Dynamic can't be empty to begin with, good deal. All working now, I had to create a few different variables but all works great, thanks for the help.