How to update value in angular ui typeahead directive if no matching option is found - angular-ui-bootstrap

I've an array of objects containing title and salary which is used in typeahead directive.
I display department name and get entire object as value.
If none of the options match, I want user entered string to be converted to object still. Is there any way to update that?

This answer is pretty late, but I would just use ng-blur (to trap the end of the users input) along with a variable bound to typeahead-no-results. Then test if the variable is true in the method bound to ng-blur, and, if so, make an object out of the String supplied by the user and push it to your data source. Simple example found here.

Related

How to access object field in qaf step from stored variable

In my previous question I was looking for a way to access and store return value of the function in qaf step. I was provided with the following:
When create new user using "{'name':'user1','password':'user123'}"
And store into 'newUser'
Then system should have user '${newUser}'
Now, I'd like to know how to get value from object/collection stored.
If it is a simple object named newUser which has field Id. How would I pass Id on next step?
And, if return is List, how to get by index from stored list?
Resolved issue on my own. If anyone faces same unknowns, here is how I solved it.
For requirements to work around response data, parsing same stored objects in properties by specific fields or collecting data from other structures such as Maps or Lists, create common functions with #QAFTestStep annotation to get data for class member name, map by key or list by index and so on... Add those in common steps and then write stepname text in gherkin format with parameters specified. Let me know if someone needs help, always ready to help out...

ExtJs6: Ext.ComponentQuery.query('#autogenerated_id') returns an empty array if the component has an itemId

I have some ExtJs component.
I set itemId for it, but id is autogenerated.
Now Ext.getCmp('autogenerated-id') returns my component.
But Ext.ComponentQuery.query('#autogenerated-id') returns an empty array.
But:
Ext.ComponentQuery.query('[id=assets-information-form-1918]') again returns my component. :)
I use ExtJs 6.5.3 classic.
It seems like itemId config property hides autogenerated id from Ext.ComponentQuery, so they become mutually exclusive.
I don't need other means for search or advice to set id for the component, to write letter to Sencha support or to write post on their forum.
I need:
Means to force my Ext.ComponentQuery.query('#autogenerated-id') to
find the Component for which getId() returns 'autogenerated-id'.
If it is not possible by design, I need a link to some documentation
describing this behavior, a link to some bug report, or a filename and line number in ExtJs sources + a little snippet copy/paste from there.
From the documentation
Summary Provides searching of Components within Ext.ComponentManager
(globally) or a specific Ext.container.Container on the document with
a similar syntax to a CSS selector. Returns Array of matching
Components, or empty Array.
Ext.ComonpentQuery.query('#itemId') returns and array. Your cold above is using the auto-generated id of the component. The # indicates to query based on the component itemId and not the component id.
Try
Ext.ComponentQuery.query('assets-information-form-1918');
which will return an array, as noted in the documentation.
Ext.getCmp()
This is shorthand reference to Ext.ComponentManager#get. Looks up an
existing Ext.Component by id
Therefore it returns the component object.
Ext.ComponentQuery.query('#itemId')[0] would return the first object in the array.
Ext.ComponentQuery is the Sencha preferred method because it is more powerful when used as it does return an array so you an also query items by xtype and other attributes.

Archer to Archer Data Feed in RSA Archer

Need to create Archer to Archer Data Feed that should set value of two fields as NULL in a cross referenced application, if the value of a field is Approved in first field. I am not getting how can I send a NULL value to the fields through data feed??
Archer doesn't have "NULL" value, but you still can get it done like this:
Step 1. Calculation. Open your data feed configuration and go to the source definition tab. Add a new field to the end of the list and make it calculated.Add formula to check value of 1st field that present in the data source and if it is equal to "Approved" then return empty string.
Something like this
=IF([field field] = VALUEOF([first field],[Approved]), "","SOMETHING ELSE")
The key here is to have this calculation return an empty string when you need it - "".
I suggest you to test your calculation in the calculated field in the application before you put it in the calculated data source field.
Step 2. Data feed mapping. Now you need to map new calculated field in your data feed to the field you want to remove value from. Go to the mapping tab in your data feed configuration and map the field. Make sure to selection options "Replace value" and "Empty Values" - this way existing value will be replaced even with empty values.
Similar approach works for me in multiple data feeds.
Good luck!
You can use novalue() function in the calculation
I don't believe there is a concept of NULL in Archer. The closest you're probably going to get is blank/empty. To do that, in the Data Map tab of your data feed, click the edit icon under Actions column. Check the box that Empty Values should be populated rather than ignored.
Assumption is that what is in the question is the only task required by the data feed.
Create report with the filter set as First Field = Approved
Fields to display should contain tracking id (tracking ID which is configured to System ID) of the Target app along with the Tracking ID of the Cross-Reference App.
In Source Definition add new source and give it an adequate name as clear or Null if you want
Where it says Raw Data Field in the drop-down, update this to static. Leave the source as not configured or unconfigured.
Map this newsource to the 2 fields that you are trying to clear. In Options set to Replace and uncheck add unknown and set to populate empty values.
Map the Tracking ID of the Target app and map the Tracking ID of the cross-reference.
Set key field definition for both apps to the tracking id
Set data feed to update only. Remove checkmark for create
If your are doing more than just clearing the 2 fields, then
Stan Utevski answer is mostly correct except you must have the field you are evaluating for "Approve" in the fields to display of your report. Otherwise the calculation will not validate.

How do you get the value of a data attribute within an event-based rule in Adobe Dynamic Tag Manager (DTM)?

I have an event-based rule configured to fire on click of an element with a specific class. On click, I would like to capture the value of a data attribute that exists. The DTM documentation says you can capture attribute values using this syntax:
%this.data-event%
or
%this.id%
Example HTML:
On click of links with the class "test", I would like to store the value of "event name" within an eVar. When I used the above syntax however, the syntax is converted to a string and in the Adobe server call as:
v25:%this.data-event%
What is the best way to dynamically grab the value of an attribute of an HTML element on click within DTM?
DTM documentation says you can do that, but in practice I too have found that it doesn't seem to work as advertised most of the time, and will instead populate it with a literal (un-eval'd) string like that.
So what I do instead is under Conditions > Rule Conditions I create a Custom condition. In the Custom condition, I add the following:
// example to get id
_satellite.setVar('this_id',this.id);
// example to get href
_satellite.setVar('this_href',this.href);
return true;
Basically I create on-the-fly data elements using javascript, and then return true (so the condition doesn't affect the rule from triggering).
Then I use %this_id%, %this_href%, etc. syntax from the data element I created, in the Adobe Analytics section variable fields.
The easist way to capture the values of a data attribute against an eVar or prop on the element clicked using DTM is to set the input as the following:
%this.getAttribute(data-attributename)%
For example, if there was a data attribute on an element of data-social-share-destination='facebook' simply input %this.getAttribute(data-social-share-destination)%. This will then capture the value of 'facebook'
More detail on data attributes can be found at http://www.digitalbalance.com.au/our-blog/event-based-tracking-using-html5-custom-data-attributes/
I found a solution. The best way to grab the value of an attribute on click is to use this syntax:
%this.getAttribute(data-title)%
The key is to not use quotes around the attribute name AND ensure the attribute has a value.
If the attribute is missing, the expression is not replaced by an empty string as one would normally expect from experience in other platforms, but instead will display the raw un-interpolated code.

How to pass a map from gsp to controller as part of params in Grails remoteFunction

I am trying to send map from gsp to controller but the map is considered as a string in the controller
<g:remoteFunction
action="updateCart"
params="{startDate:stDt,endDate:endDt,cartId:pkid,shoppingCart:'${shoppingCart}'}"
update="resourcesSelectedId"/>
Here the shoppingCart is a grails map variable I am trying to send
Edit:
there was a typo in the code I posted above. Missed starting "{" in the params
params="{startDate:stDt,endDate:endDt,cartId:pkid,shoppingCart:'${shoppingCart}'}"
Updated my question as per my comments below
In my case shoppingCart is an object and it has, lets say for example, items and quantity of each item. I have some rules to be applied based on the items selected and quantity and determine the price for each item and show it back to the user. I want to do this processing the controller. Whenever user updates the cart I need to re-calculate and show it back to user. Is there any other better approach you would suggest to do this instead of passing the objects back and forth
Anytime you're using the params attribute, it has to be in the format of a Map anyway, which means including the [ ]. This also means you can exclude the ${ } from any values because grails will parse all these as potential variables.
<g:remoteFunction
action="updateCart"
params="[startDate:stDt,endDate:endDt,cartId:pkid,shoppingCart:shoppingCart]"
update="resourcesSelectedId"/>
However, keep in mind that you can't send objects. I'm not sure what shoppingCart is in your example, but it would only be able to be a simple value that can be represented as a String. Possibly you would want shoppingCart.id? Otherwise, that should get you going in the right direction.
I could able to overcome this issue by following below steps
converted the shoppingcart object to json string
Pass the json as part of the params
parse the json string server-side & process
pass the updated object back to gsp

Resources