Coming back to this issue as I now have the time to work on this next stage of my first Clarity Studio project.
I think I understand your examples, but coming from procedural languages (e.g. C# or even T-SQL) where you declare a variable, then assign a value to it an keep it alive for later use, this is still confusing in Clarity Studio to me.
This is what I need to do. I have a set of complex queries to finally go into Grid Portlets. One of them requires a total value calculated, then this value used in a subsequent query.
Specifically, in MSSQL I declare a variable, then calculate a COUNT(*) and put the result into this variable. Simplifiying the queries for the example:
-------------- #1
Declare @TotalBillableProjects as float
select @TotalBillableProjects = count(p.Name)
from
srm_projects p
(some joins here)
where (conditions here)
--------------
Now I have a temporary value in @TotalBillableProjects that I can later use in another query to calculate a percentage of incidences over the total as follows (simplified example):
-------------- #2
select FunctionalArea,
count(p.Name) as [Number of Billable Projects],
CAST(((count(p.Name)/@TotalBillableProjects) * 100) as decimal(5,2)) as [% of Billable Projects]
from .....
--------------
As you can see, now I use @TotalBillableProjects to calculate the percentage (I do the same with several other variables).
In my very limited knowledge of Clarity at this stage, I figure I could create a separate NSQL query for example #1 here, save the total to some holding variable (this is what I don't know how to do yet), then create NSQL query #2 and fetch and use this calculated total from the first query.
Now I could create a portlet that would run #1, then run #2 using the calculated total from #1 and finally put #2 into a grid portlet.
Q: How/where do I create this holding variable (and many others I'll need) for this?
Alex