Orbeon - how to set values of numerous fields with one query - orbeon

I have created a database service that retrieves numerous columns. I have successfully created the action to call other queries which passes in a parameter and displays the output in drop-down box or check boxes. HOWEVER, with this new query I would like to set the values of 5 different fields on the form based on the single query call. What xpath expression syntax is needed in the 'Set Response Control Values' section in order to make this work.....or is this not the right place or way to do this?

Sounds like you're using Form Builder - in the "Set Response Control Values" section in the Actions Editor, you should set up one item for each form field to be updated, with the Destination Control drop-down specifying the form field. So in your case you'll have 5 rows pointing to your 5 fields.
Let's assume that your query returns a single row, with the values that will go into your form fields in separate columns. Your query results come from the database service looking like this:
<response>
<row>
<query-column-1>value</query-column-1>
<query-column-2>value</query-column-2>
...
</row>
</response>
So if the column name for your first item is "id", the "Set Response Control Values" entry would look like this:
/response/row/id
There is one gotcha...if a column name in the database includes an underscore, this will be converted to a hyphen in the results from the database service. So if your column name was "asset_id" you'd put response/row/asset-id.
If your query returns multiple rows, you can refer to a specific row using a predicate, like so: response/row[1]/id

Related

Create a query params with combobox in Foxx

I wonder if I can create a query param that take multiple values from dropdown just like a non-typing combobox in the UI of ArangoDB. For example
//A route....
.queryParam('A', joi.any().allow(["true","false,"haha"]).required().default("true"))
The one above produce an dropdow that allow you to choose only 1 value. Is it possible to make them behave like a combo box on arango's UI?
I use this query param join's validation that shows as a drop down in the Arango UI
.queryParam('direction', joi.string().lowercase().valid('inbound', 'outbound', 'any')
.required().description('Direction of traversal from given product (inbound/outbound/any)'
))

App Inventor Fusion Table Column calling

I developed an app based on App Inventor and Fusion Tables. When I want to update total money by adding some money to already existing money it is giving some error.
When I use SELECT command to get information from fusion table it is taking then number with column Name. When i am trying to add both of them it is giving following error.
Error message
The result from a fusiontable includes always the header row...
from your example SELECT statement the result is
TotalPaid
5000
Obviously to add any value to that result will result in an error, because you only can add numeric values...
You first have to extract the value (in your example 5000) from the result. Convert the result into a list using the split block, just split at \n (new value) to get a list, then select the 2nd item using the select list item block.
Note: to be able to update something in a table, you need the ROWID, see also the SQL Reference Documentation of the Fusion Tables API.
For UPDATE statements the first step to be done is to get the ROWID of the row to be updated with a SELECT statement. The second step is to do the UPDATE.

Query Influxdb based on tags?

I have started playing around with Influxdb v0.13 and I have some dummy values in my test db where id is a tag and value is a field:
> SELECT * FROM dummy
name: dummy
--------------
time id value
1468276508161069051 1234 12345
1468276539152853428 613 352
1468276543470535110 613 4899
1468276553853436191 1234 12
I get no results returned when I run this query:
> SELECT * FROM dummy WHERE id=1234
but I do get the following when querying with the field instead:
> SELECT * FROM dummy WHERE value=12
name: dummy
--------------
time id value
1468276553853436191 1234 12
Am I doing something wrong here? I thought the point of tags were to be queried (since they are indexed and fields are not), but they seem to break my queries.
It appears that Influx will treat every tag key and value we insert as string and this is evidently shown in their official documentation.
See: https://docs.influxdata.com/influxdb/v0.13/guides/writing_data/
When writing points, you must specify an existing database in the db
query parameter. See the HTTP section on the Write Syntax page for a
complete list of the available query parameters. The body of the POST
- we call this the Line Protocol - contains the time-series data that you wish to store. They consist of a measurement, tags, fields, and a
timestamp. InfluxDB requires a measurement name. Strictly speaking,
tags are optional but most series include tags to differentiate data
sources and to make querying both easy and efficient. Both tag keys
and tag values are strings.
Note: the text in bold.
Hence to filter by tag key value - the query must be enquoted.
Example:
SELECT * FROM dummy WHERE id='1234'

Mapping Values in Qlikview

In Qlikview, I have an excel sheet that I use to map USERNAME to a TEAM value. But everytime I refresh the dashboard, new USERNAME values come up and since they are not in the excel sheet, these USERNAME values show up as their own value in the TEAM column. How would I make it so that any USERNAME that is not in the excel sheet shows up as 'Unidentified' or another value under the TEAM column instead of showing up as their own separate value?
First of all when posting question here if possible always include the source code so everybody will have more clear picture about your problem. Just saying.
On the topic ...
Use the mapping load in this case with supplying the third parameter. For example:
TeamMapping:
Mapping
Load
UserName,
Team
From
[User_to_Team_Mapping.xlsx] (ooxml, embedded labels, table is [Sheet1])
;
Transactions:
Load
Id,
Amount,
ApplyMap( 'TeamMapping', User, 'Unidentified') as Team
From
Transactions.qvd (qvd)
;
The third parameter in ApplyMap is the default string value when mapping value was not found in the mapping table (TeamMapping)

Customizing jQuery UI Autcomplete

I want to make a few customizations to jQuery UI Autcomplete:
1) If there are no results found it should output "no results found" in the list.
2) Is it possible to highlight/bold the letters in the results as they are being typed? For example if I type "ball" and I have "football" in my results it needs to output as foot ball
3) Is it possible for the results that appear at the top to match the beginning of the string. For example suppose I have 3 entries in my database:
Astrologer
Space Station
Star
I start typing "st" - this will bring up those 3 entries in that order. But I want "Star" to be the first result.
The MySQL query being used at the moment to generate the results is:
$query = mysql_query("SELECT id, name FROM customer WHERE name LIKE '%".$_GET['term']."%' ORDER BY name");
You can simply echo 'No results found' inside the script that returns the list if num rows from your mysql_query is 0.
This was possible in the original Autocomplete plugin but I can't see it anywhere in the JQuery UI documentation.
You may have to run two separate mysql queries - the first one looking for LIKE '".$_GET['term']."%' and the second one as you have it, but excluding the results you've already got from the first query.

Resources