Orbeon: dynamically add item to select object - xpath

I would like to add the items to select object based on value of another fields. For example, if my related field have value "1", i would like to have only one item into select object.
Thanks!

I solved this problem using orbeon "Database service", i'll try to explain it step by step.
1° i have added a "database services" that create temporary table into database (in my case database server is oracle) with this sql code:
with t as
(
select (i.column_value).getnumberval() Codes from xmltable('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20') i
)
SELECT Codes as id, CONCAT(Codes, '° select') as value FROM t
WHERE Codes < (<sql:param type="xs:string" select="''"/> +1)
This query creates a list of items with "id" and "value". To see the output of the query run it into one oracle client.
2° i have added an "Actions" where i set into the field "Service to call" my database service, into the field "Set Database service parameter" my input field that contain number used by my query and into the field "Destination selection control" the destination dropdown menu.
For more details on how to configure dropdown menu follow this link http://discuss.orbeon.com/Prepopulating-the-dropdown-with-database-service-is-not-working-td4656948.html where there is the screen shot.

Related

How to make a LOV in Oracle ADF that also returns a static value?

Say I want to have a lov of colors. Red , Blue Green. I want an LOV that retrieves those values from a database but on top of that I want to add one more value "All". So the LOV could be a list of someone's potential favorite color and by default the "All" option is displayed in the LOV. A user can choose any color or maybe decide to revert to the 'ALL" option.
Is it possible to add this static value to an LOV that retrieves values via a db? I know you can just create a static LOV but the point is we need to retrieve the latest colors or whatever value is in the db if it ever grows.
Edit: JDeveloper 12c (12.1.3.0.0)
If the 'all' option is valid, you should add it into the DB, like the other colors. If you don't want to put 'all' into the DB, you can use SQL and create the 'all' option as a static result before the actual query to the table using a union SQL statement.
One other way to archive this is to add the 'all' option to the items list in a bean, like it's shown here https://community.oracle.com/tech/developers/discussion/616712/adf-faces-how-to-add-static-option-to-dynamic-lov
You still have to think about what should happen if the user selects 'all' from the list. How does the UI handle this?
I think you should insert "All" value to table in database. The table should contain "ORDER_COLOR" column. We will prepare data some thing like:
("All", 999999)
("RED",1)
("BLUE, 2)
("GREEN",3)
("NEWEST_COLOR",4)
In ViewObject query. You can order by ORDER_COLUMN desc. The ALL will on the top and next one is NEWEST_COLOR

ServiceNow "Display Value"

I am not able to understand the meaning of "Display Value" in Service Now.
I found some of the documents on the web. But that was not helpful.
Think of it as choosing what field to use as the "Name" of the record. It's what shows up in reference fields, when you call the GlideRecord.getDisplayValue() function, and other places in the system.
Let's say for simplicity you have a table called "Problem" with 3 fields:
Number
Creation date
Created by
You're on the "Incident" table, and you want to link the incident to a certain problem. You open up the reference picker and choose the problem from the popup list, but when you return to the incident form the value showing in the field "Problem" says "2017-05-08 10:30:50". This indicates that the "Display Value" field is set to "Creation date". The incident is linked to the correct problem, but it's just the "Display Value" is not set correctly.
If you updated the "Problem" table so that it's "Display Value" field was "Number", then when you chose the problem to link your incident to, the "Problem" field on the incident record would show up for example like "PRB000005".
There can only be one display value per table. If you change a field to be the display value for that table, any other field on that table with display value = true will be set to display value = false.

SSRS reports dynamics crm have current record id used as parameter

Hi for my ssrs report In dynamics crm I require that when the report is ran against a certain record, the records passes the record id so that only the relevant results are displayed.
How is this possible ? Steps provided will be great also
Reports are created using SQL.
Run against campaign entity
SSRS reports for CRM have special parameters that enable this for you. To filter by selected records (or the current record you have open) you can utilise a hidden parameter called "CRM_Filtered[Entity]" where entity is the relevant entity you are linking the report to.
In your case, i.e. for the campaign entity, this hidden parameter will be called CRM_FilteredCampaign. For a SQL report this will be a text parameter and will be set to something like this (set by CRM when you run the report)
select campaign0.* from FilteredCampaign as "campaign0"
I do not have a report to hand to check exactly what the SQL will contain, so it might not be exact. But you get the idea. There are several ways to embed this in your report, but you could do so in a rudimentary fashion like this in a dataset:
declare #sql as nVarchar(max)
set #sql = 'SELECT c.campaignid FROM (' + #CRM_FilteredCampaign + ') as c'
exec(#sql)
Expanding on this, i.e. rather than executing text SQL in your main dataset, you can instead simplify the usage by creating a dataset/parameter combo based off the text. In effect, convert the SQL text to a list of values instead.
So add the above SQL to its own DataSet (for this example called DS_FilteredCampaign).
Once you have created DS_FilteredCampaign make sure you click on the Refresh Fields button. Type in the following instead of <null> for the parameter value:
select c.* from FilteredCampaign as c
Once that comes back click on Ok to save the DataSet.
Next, create another hidden text parameter (e.g. Int_FilteredCampaign) and tell it to get its default value from a DataSet (not its available values, its default value). Point the values at DS_FilteredCampaign, and you should be able to select campaignid as its value field. This in effect makes the parameter an array of Ids you can reference in your main DataSet
Now it's much more usable as you can reference it in your SQL something like this in your main DataSet:
select c.*
from FilteredCampaign c
inner join ActivityPointer ap on ...
inner join FilteredAccount a on ...
where c.campaignid in (#Int_FilteredCampaign)
The important piece being where c.campaignid in (#Int_FilteredCampaign)
Summary Steps:
You have a main DataSet called something like dsMain
Create a new parameter called CRM_FiltetedCampaign
Create a DataSet (DS_FilteredCampaign) that executes the SQL passed into CRM_FilteredCampaign
Refresh Fields on the data set to get the campaignid field
Create a text parameter (Int_FilteredCampaign) that retrieves its default value using the new dataset (DS_FilteredCampaign) using campaignid for the value
Reference this new parameter in you dsMain dataset

Open formula doesn't return name

I have written open formula in Pentaho Report Designer 5.0.1 as:
=SINGLEVALUEQUERY("SELECT name FROM income_product where order_no=1";)
Rather than writing a query on data set and call from SINGLEVALUEQUERY() I want the string value from the above query.
PRD doesn't complain about the above formula as syntax error; it just returns null/nothing. What (if anything) is wrong in that formula?
I want to write that formula to generate dynamic column name for a report having order number 1 or greater. Is there any other way to make the column name dynamic for a report?
By "Dynamic column name", I mean making different organization have unique income_product_order.
If I just assign the order_no of income_product it automatically gets income_product_name as the column name for all organizations.
Did you set up your connection correctly? try adding a query over that connection and paste that query there. Does it return any data?
This is a good blog post on the subject: https://www.on-reporting.com/blog/using-queries-in-formulas-in-pentaho/
You can enable the "Display the index columns (...)" option under Settings. It'll allow you to reference columns either by name or by index (column0, column1, etc.)

Dropdown with Checkbox in SSRS

I have a report in SSRS which is generated for around 50-60 items.
Say, the report shows Country name on one scale and their population on another.
When the graph is generated, it shows around 100 countries.
If I want to see population of only UK, US, India and China. Then I Should have an option to select the countries of my choice.
Having one dropdown and allowing them to select only one country at a time is simple.
I have no idea on how I can have a checkbox in dropdown to allow multiple selections.
TIA.
You'll want to search for Multi-valued Parameters. If you open the properties of the parameter there will be an option something like "Allow multiple values". Reporting services will handle the UI with checkboxes.
One important thing to know about multi-valued parameters is how to use them in your query. Suppose your parameter #CountryId is being filled with this query:
SELECT CountryId, -- This will be the value for the parameter
CountryName, -- The label for the parameter
FROM Country
If you set this parameter to allow multiple-values, reporting services will generate the multi-select UI for you. When executing any subsequent query that uses the parameter, before sending the query to your SQL server it will replace the parameter with a comma-seperated list of CountryId values. So this query:
SELECT *
FROM MyDataTable
WHERE MyDataTable.CountryId IN (#CountryID)
Will be sent to SQL server as something like this, supposing there are 3 countries selected:
SELECT *
FROM MyDataTable
WHERE MyDataTable.CountryId IN (1001,1002,1003)

Resources