How to pass list of value to an alexa slot in an intent - alexa-skills-kit

I want to define an order intent something like "I want two pencil,one notebook, four cardbox".
In alexa build model it looks something like the following
I want {itemQuantity}{itemList}
here {itemQuantity} is defined as Amazon.number and {itemList} is defined as custom slot which could have this set of values {pencil,notebook,eraser,cardbox,sharpner}.
Now If I make the following utterance "I want three eraser" ,it worked perfectly.it returns itemQuantity as 3 and itemList as eraser.
But when I make the intent with multiple values like this "I want two pencil one notebook four cardbox". It returns me itemQuantity as 2 and itemValue as "two pencil one notebook four cardbox".
Rest of the string come entirely as itemList.
I want to get this input in form of array/list like itemQuantity = {2,1,4} itemList = {pencil,notebook,cardbox}

You can't do that in an easy way.
The simplest thing you can do is define utterances like:
I want {itemQuantity1}{item1}{itemQuantity2}{item2}...
So you have to specify in the utterance all the possibilities for the list. If you have maximum fixed length list I think it is the right way to do.
Or you can use AMAZON.SearchQueryslot (link) and process the whole phrase (that should be two pencil one notebook four cardbox) in the backend of the skill and extract the values that you need.
But in that way you have the limitation of the needed carrier phrase for that type of slot (see linked docs).
Another workaround could be catch all slots (not working 100% of the time btw) but as above you have to deal with the whole phrase in the backend and process it.

Related

using multi choice and collection in blueprism

I have about 3 collections and i want to write into an excel and send them in mail separately, I tried to use multi choice to finalize one after the other but it doesn't work
any other idea how to do this?
I will put screen shots below for more illustration
It's likely not functioning the way you intended because each of the three Data Items you're attempting to compare to a blank string ("") aren't Text-typed - rather, they're Collections. Collections themselves can't be compared to strings (see: apples and oranges), but the data contained within them can.
What you're likely attempting to do is to compare the value within the current row of each of those collections - it's not clear what the field name is from your screenshot (the field name itself is cut off on the right edge) but your comparisons should look something like the following:
[No Amount.Politic]<>""
[Pending difference.Field]<>""
[Ready to print.Field]<>""

Speech Recognizer in App inventor doesnt work to strings

I created a basic app (to practice).
So, i created one with this one:
Test App
So, when the button "habla" it's clicked the recognizer starts. After that i do a condition that compares the text obtained in the recognizer with the word "day". And if the word is same the player1 starts.
Now, i change the word "day" to "day tripper" and doesn't works. So how i can do to the recognizer detects string or more than 1 word?
The number one skill involved in debugging is problem finding, and the problem you have stated for this is
I change the word "day" to "day tripper" and it doesn't work.
What you need to do, then, is change the logic flow from if mus.result = "day" to if mus.result includes "day".
One way to make this happen would be to initialize a new variable (name doesn't matter) as an empty list. Then, inside of the mus.AfterGettingText control block, set the variable to split at spaces mus.result. Split at spaces is a text function that creates a list of the words in a string.
Then, all you need to do is check each element in the list to see if it is the word "day". This way, the input can be any sentence with the word "day" and player1 would still start.

Issue is clicking web-element in a table in qtp

I have a question in UFT 12.
My scenario is:
1. Type text in a WebEdit. Say "GOOG"
2. When I type "GOOG" slowly, it lists out the symbols that start with "G". From this list out, I want to select the first element.
3. Once I click on the first element, the Google quotes are displayed.
My Issue:
UFT just types GOOG and doesn't show me the list that lays out for me to select the first element that starts with "G".
From the Object spy, I managed to find the first element as a web element.
I tried many different ways like childitem etc. Nothing seems to work. Please help me out.
I am not able to attach my screen shot here. This is something similar to Google suggest where you type and it suggests you so many options and go with the first option.
It seems like you're trying to automate auto-complete textbox. So you should not directly paste the string value in the textbox as we used to do for normal edit controls, instead you should split the string into separate characters and type one by one.
If if you do in such a way, then the AUT will list the matching options to pick. From there you can select the required option. Then you may use SendKeys method (** something like Down Arrow + Enter) to pick the selection.
Just a have attempt in this way - good luck!

Filtering a multivalued attribute in StringTemplate

I have a template which uses the same multivalued attribute in various places. I often find myself in a situation where I would like to filter the attribute before a template is applied to the individual values.
I can do this:
<#col:{c|<if(cond)><# c.Attribute2 #><endif>};separator=\",\"#>
but that is not what I want, because then there are separators in the output separating "skipped" entries, like:
2,4,,,6,,4,5,,
I can modify it to
<#col:{c|<if(c.Attribute1)><# c.Attribute2 #>,<endif>};separator=\"\"#>
Which is almost OK, but I get an additional separator after the last number, which sometimes does not matter (usually when the separator is whitespace), but sometimes does:
2,4,6,4,5,
I sometimes end up doing:
<#first(col):{c|<if(cond)><# c.Attribute2 #><endif>};separator=\"\"#>
<#rest(col):{c|<if(cond)>,<# c.Attribute2 #><endif>};separator=\"\"#>
But this approach fails if the first member does not satisfy the condition, then there is an extra separator in the beginning:
,2,4,6,4,5
Can someone give me a better solution?
First, let me point out that I think you are trying to do logic inside your template. Any time you hear things like "filter my list according to some condition based upon the data" it might be time to compute that filtered list in the model and then push it in. That said something like this might work where we filter the list first:
<col:{c | <if(c.cond)>c<endif>}:{c2 | <c2.c.attribute>}>
c2.c accesses the c parameter from the first application
The answer by "The ANTLR Guy" didn't help in my case and I found another workaround. See at Filter out empty strings in ST4

AdvancedDataGrid (grouping) quick jump to row

I have a problem with the AdvancedDataGrid widget. When the dataProvider is an ArrayCollection (of arrays), the nth array (within the collection) is also the nth row within the grid, and I can jump and display the i-th row by scripting
adg.selectedIndex = i;
adg.scrollToIndex(i);
now, when I add a Grouping, the dataProvider ends up being a GroupingCollection2, and now the index in the dataprovider's source does not correspond to the index in the adg anymore (which is understandable, because it's being grouped).
How can I select and display a row in grouped data efficiently? Currently, I have to traverse the adg and compare each found item with its data attributes in order to find the correct index of the row within the adg, and jump to it like above. This process is very slow. Any thoughts?
edited later:
We already used a caching object as Shaun suggests, but it still didn't compensate for the search times. In order to fully construct a sorting of a list of things (which this problem equates to, as the list is completely reordered by the grouping), you always have to know the entire set. In the end we didn't solve that problem. The project is over now. I will accept Shaun's answer if no one knows a better way in three days.
Depending on what values your comparing against you can store the objects in a dictionary with the lookup using the property/properties that would be searched for, this way you have a constant time look-up for the object (no need to look at every single item). Say for example your using a property called id on an object then you can create an AS object like
var idLookup:Object = {};
for(myObject in objects)
idLookup[myObject.id] = myObject;
//Say you want multiple properties
//idLookup[myObject.id]={};
//idLookup[myObject.id][myObject.otherProp] = myObject;
now say the user types in an id you go into the idLookup object at that id property and retrieve the object:
var myObject:Object = idLookup[userInput.text];
myAdg.expandItem(myObject, true);
now when you want to get an object by id you can just do
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/AdvancedDataGrid.html#expandItem()
I haven't done any thorough testing of this directly, but use a similar concept for doing quick look-ups for advanced filtering. Let me know if this helps at all or is going in the wrong direction. Also if you could clarify a bit more in terms of what types/number of values you need to lookup and if there's the possibility for multiple matches etc. I may be able to provide a better answer.
Good luck,
Shaun

Resources