Migrate autocomplete field to dynamic dropdown - orbeon

I’m using Oberon forms version 2019.2 CE.
I want to migrate autocomplete field to dynamic dropdown. As resource (Resource URL) I'm using address: <my_service_address>/name={$fr-search-value}&param2={../c_field_name}
c_field_name is other dynamic dropdown.
When I’m using autocomplete everything is fine (correct response from service), but when I switch to dynamic dropdown the response is incorrect (empty response). It looks like {../c_field_name} is empty value.
When I pass some test value to my service (instead of {../c_field_name}), for example:
<my_service_address>/name={$fr-search-value}&param2=1
everything work fine, so my service working well.
I tried to use $c_field_name instead of {../c_field_name}, but it is not worked.
Do you have any suggestions?

Instead of ../c_field_name, use xxf:instance('fr-form-instance')//c_field_name.
Also see the form attached to this message, which uses this technique to create chained dropdowns, where each dropdown passes to the service the value selected by the user in the previous dropdown. And ideally, you should be able to just write $c_field_name, which is covered by request for enhancement #309.

Related

ServiceNow Rest API (using PowerBI)

I'm on a project in which I need to get data from a ServiceNow instance and treat all data with PowerBI. I'm able to retrieve a big amount of data (Snow collect a lot of data), but I still need a way to filter data correctly. I'm calling to this URL:
Besides, I want also to apply a filter to retrieve just some specific registries from the table Requested Items. For that, I use the sysparm_query parameter to filter the field "cmdb_ci" and more specifically it's "name", something like:
&sysparm_query=cmdb_ci=What I need to Filter
Apart from this, I have also tried:
&sysparm_query=cmdb_ci.value=What I need to Filter
&sysparm_query=cmdb_ci.display_value=What I need to Filter
&sysparm_query=cmdb_ci.sys_id=What I need to Filter
&sysparm_query=cmdb_ci.name=What I need to Filter
But still not found the solution... as all these does not respond the solution needed.
Does someone know how I can manage this?
Thanks!!
JLG
There are two "Configuration item" fields in sc_req_item: cmdb_ci and configuration_item. Make sure that you are using the correct one. Either cmdb_ci.name=value or configuration_item.name=value should work, depending on which of the two fields you are using. cmdb_ci.value and cmdb_ci.display_value will not work as there are no fields on the record with these names. cmdb_ci.sys_id should work if you are supplying a sys_id (although it is redundant to type .sys_id for a reference field).
You should first verify your query through the ServiceNow UI before attempting to use it in an API call.
Type sc_req_item.list in the Filter navigator
On the filter list select "Show related fields"
Get your filter to work correctly
Right-click on the filter and select "Copy query"
The next step is to test it using the REST API Explorer.
Final step is to configure your client tool (PowerBI).

Split datetime value received from external API in Rails app

I have a datetime value which comes from the API in this format: 2015-07-07T17:30:00+00:00. I simply want to split it up between the date and time values at this point. I am not using an Active Record model and I prefer not to use an sql database if I can.
The way I have set up the app means that the value is "stored" like this in my view: #search.dining_date_and_time
I have tried two approaches to solving this problem:
Manually based on this previous stackoverflow question from 2012: Using multiple input fields for one attribute - but the error I get is the attribute is "nil" even though I put a "try"
Using this gem, https://github.com/ccallebs/split_date_time which is a bit more recent and seems to be a more elegant solution, but after closely following the doc, I get this error, saying my Search model is not initalized and there is no method: undefined method dining_date' for #<Search not initialized>
This is when instead I put #search.dining_date in the view, which seems to be the equivalent of the doc's example (its not that clear). The doc also says the method will be automatically generated.
Do I need to alter my model so I receive the data from the API in another way? ie. not get the variable back as #search.dining_date_and_time from the Search model for any of this to work?
Do I need an Active Record model so that before_filter or before_save logic works - so i can (re)concatenate after splitting so the data is sent back to the API in a format it understands. Can I avoid this - it seems a bit of overkill to restructure the whole app and put in a full database just so I can split and join date/time as needed.
Happy to provide further details, code snippets if required.
As I am not using a conventional Rails DB like MySql Lite or Postgresql, I found that the best solution to the problem was by using this jQuery date Format plugin: https://github.com/phstc/jquery-dateFormat to split the date and time values for display when I get the data back from the API.
The Github docs were not too expansive, but once I put the simply put the library file in my Rails javascript assets folder, I just had to write a few lines of jQuery to get the result and format I wanted:
$(function() {
var rawDateTime = $('#searchDiningDateTime').html();
// console.log(rawDateTime);
var cleanDate = $.format.date(rawDateTime, "ddd, dd/MM/yyyy");
// console.log(cleanDate);
$('#searchDiningDateTime').html(cleanDate);
var cleanTime = $.format.date(rawDateTime, "HH:mm");
// console.log(cleanTime);
$('#searchTime').html(cleanTime);
});
Next challenge: rejoin the values on submit, so the API can read the data by sending/receiving a valid request/response. (The values can't be split like this when sent to the remote service).

Perfecto Mobile ScriptOnce - Is it Possible to perform an action on an object (not just retrieving the value) using html_id instead of control_id

Working with MobileCloud Automation from Perfecto Mobile using ScriptOnce on a jquery-mobile application.
I want to find out if it is possible to perform an action on an object (not just retrieving the value) using html_id instead of Perfecto Mobile's control_id.
Background:
We have already created an object repository with html_id ids.
I want to have the scriptOnce automation more easily find the objects by the html_id values in our object repository.
Is it possible, and how do I set the html ids to be used?
You have the option to work with html_id's or html_name's.
You need to check the "show advanced parameters" box and then just type the id or name of the html element.
If you work with their QTP solution, and say you want to put the user name in a text box with id = userIdInput, then the syntax would be something like that:
Device("DUT").MWebEdit("html_id:=userIdInput").Set "my_username"
Hope it helps.

How to find component inside P:Datalist in primefaces?

I have component hierarchy such as this
Form>P:DataList
>DataTable1
>DataTable2
When I see the generated html code or developers tool in ie, I found
the client id generated for the datatables are
form:datalist:0:DataTable
form:datalist:1:DataTable
However when I invoke
ViewRoot.findComponent
with the above client Id,
it return null.When I removed the "rowIndex" value i.e 0/1
it then only returns the first datatable.
How to make it work so that I can find both the data tables
from backend using their Ids?

Auto Search functionality for Schools/Universities using Asp.Net MVC

I am building a website where the user should have the capability of adding their School/University. I have noticed in LinkedIn, when i tried to type in my school name , it showed up a auto search box with all the schools, beginning with the letter i typed. How can i achieve the same functionality?
Do they save all the Universities in their database ? Or is there any Open webservices i can use that will show all the Schools/Universities ?
Thanks !
This feature is called "Auto Complete" and the text boxes are enabled with that. These allow you to filter the data required according to the characters you type in.
Please see this post for auto-complete feature implemented using jQuery.
Razor: Auto-complete text box inside jqGrid, How to bind values?
The example shown in that page lists all from the database. However, as a next phase, you can as well extend this feature to look for a WCF exposed service for universe of schools/colleges.
FYI" "GetSkillNameAutocomplete" is a method in the controller that takes a string parameter as an input (the search string) and gets the value(s).
Hope this helps!

Resources