How to populate a dropdown list with Slamdata report - mongodb

I'm using SlamData to create my report. I followed Slamdata's tutorial to populate a dropdownlist from database. I created a mark down with this query
committer = {!`SELECT DISTINCT idCategory FROM "/demo/ReportDB/TMCMSReportData" ORDER BY idCategory}
It return this error:
Can you show me why I got this error?

The correct query would be:
committer = {!`` SELECT DISTINCT idCategory FROM `/demo/ReportDB/TMCMSReportData` ORDER BY idCategory ``}
Note the use of back-ticks (not single quotes) to escape identifiers (the location in the file system) and the double back-ticks surrounding the Markdown snippet. These changes occurred recently when SlamData was updated to use the latest version of Quasar. It looks like not all documentation on the SlamData website has been updated yet.

Related

Tables are empty in Query Builder when Saved SQL script is retrieved

I saved a query I created in the SQL Developer Query Builder.
When I retrieved the query, the linked Tables don't show the Column Names in the Query Builder.
The Tables are still linked/joined to one another and the query still runs, but the columns names are blank.
How do I get the Column Name to reappear?
I'm new to SQL Developer, so I'm not sure how to resolve this issue.
Any help would be greatly appreciated.
Searched through the menus for something that would restore the columns names.
Searched through help option on SQL Developers and nothing found relating to this issue.
I was very tempted to delete this post when I found the answer myself.
However, I think there are more rookies out there like me.
The resolution is to add a semi-colon ";" to the end of the statement in the Worksheet Tab.
Even though I created the query in the Query Builder Tab, SQL Developer creates the SQL Statement in the Worksheet Tab.
So for some reason after you save that Query that was created in the Query Builder Tab; when you retrieve the script, you must add ";" to the end of the SQL Statement in the Worksheet Tab or else you get the issue I encountered with the blank columns.

How to define and use a parameter in Jasper Studio that is a set of ids?

Does anyone know how to define a parameter in Jasper Studio (Community version 6.3.1 final) that is a collection, such as a Set, and to use that in a postgresql query? For example, this Set could be a set of ids that would then be used in the query.
I do a simple sql query like:
select pg_typeof($P{companyDepartmentIds}) as type
I get the following error after selecting "Read Fields":
It seems like this should be possible, I feel I am missing something. I am not sure where in the Jasper Studio interface I can call this setObject() function. Anyone have any thoughts here?
If defining a collection of parameters can't be done, the only other thing I could think of is I could have the parameter be a String, but it would be understood it would be a comma delimited list of values, then I could use regexp_split_to_table or regexp_split_to_array within the query itself.
I was directed to this link and saw what I needed here:
https://community.jaspersoft.com/blog/tip-multi-select-query-integer-parameter-japser-ireportstudio
Specifically what I was looking for was this part from the website under the "Correct Way:" example
SELECT * from table where $X{IN,id,companyDepartmentIds}

How to send a list to query (IN condition) [duplicate]

I am working on Jasper Reports and my query uses SQL 'IN' predicate.
SELECT customer_name AS NAME,
id_customer AS ID
FROM customer
WHERE customer_role IN ($P{roles})
Here the role parameter can have 1 or more integer values and will be dynamically decided when generating the jasper report.
Can anybody please help me on how to set the value of 'roles' parameter thru Java program dynamically.
Jasper Report has a special variable $X for that:
select * from customer where $X{IN,customer_role,roles}
should work. See here and here.
The examples linked to in the accepted answer don't come up for me.
An alternative that worked for me is instead of using:
...
WHERE customer_role IN ($P{roles})
I used this:
...
WHERE customer_role IN ($P!{roles})
And for the roles variable I pass in a String containing one or more values, each in single quotes, separated by commas (e.g., '1','2','3').
See here for reference.
To complement #Aaron response, you can configure a list parameter ("roles" in your case) within JasperSoft Studio as follows:

APEX 4.0 - How to load items when using select

I have a question about APEX, I have the problem that when I try to select a value from a selectbox, no value shows in the other items. What I have tried to do is loading data from the database to the items when I select a code from the selectbox with PL/SQL. How do I do this? Selecting a code from a selectbox and filling all the other items?
Vid
Ok if i understand you right you need a List of Values.
If you create this shared Object. Use a dynamic list.
There you have a dialog you can put a PL/SQL or SQL Code snippet into.
You must return a 2 column list. The first Column is the field name in you later select box and the second is you reference.

Using LIKE with parameter expression in query

I was trying to using the like function in iReport 4.0.1. Checked online but none seem to work.
Currently trying to use:
where name LIKE'%$P!{px_name}%'
also tried
'%$P{px_name}%'
but when running the report it comes up saying 'No document'.
But when using where name =$P{px_name} it works perfectly fine.
Where clause will be same as you have used in first step which is :-
where name LIKE '%$P!{px_name}%'
But as you said report says 'The document has no pages' means the query is returning 0 row so just use the same string in LIKE and run the same query in database. Simplest solution is first run the query in database with LIKE operator , if it returns the rows in database then that should also work in iReport.