I want to set two parameters in one capsule's inuput-view file. What should I do?
In my capsule, there has a function which need two parameters and these two parameters is required. When user say one case, if this case doesn't including these two parameters, bixby will hints user input these two parameters. In the previous version I created two input-view file and one input-view file including one parameter, but now I want to set these two parameters in one input-view file, so what should I do?
In action file:
input-group(ContactAndText){
requred(OneOrMoreOf)
collect{
input(contact){
type(Contact)
min(required)
max(one)
}
input(text){
type(Text)
min(required)
max(one)
}
}
}
In input-view file: I do not know what should I do?
In action file I set a input-group(ContactAndText), this input-group including these two parameters(contact and text), but I do not know what should I do in input-view file.
I don't think having an input view for two separate objects/structures will work, however having an input view for your input-group might work. I believe can use the match pattern match: [action name]~[input-group name] (match: action~ContactAndText) to match the input-group specifically.
If this doesn't work, I would recommend either using two separate input views, one for contact and one for text, or you could create a new structure ContactAndText: make it extend Contact and make it have a text property. Then, you can have the input view match the ContactAndText structure.
An easier solution:
Add a new structure
structure (ContactAndName) {
description (a structure to hold both)
property (contact) {
type (Contact)
min (Required) max (One)
}
property (text) {
type (Text)
min (Required) max (One)
}
}
In action model
input(contactAndText) {
type (ContactAndText)
min(Required) max(One)
}
You can then implement a view with match: ContactAndName
Related
Here is I have two entity custom fields with list/record type,
custom_dev_j15 entity field has a custom source list (eg: one, two, three, four, etc)
custom_qa_v93 entity field has a standard source list as an object (eg: customer )
I've two vendor entity custom fields as stated in screenshots of question,
custentity473 --> customer is selected as list source
custentity474 --> custom_dev_j15_m_list as selected as list source ( which is custom list)
Here is snippet that i used to get the options of these fields,
// Snippet
var fieldDetails = {};
var record = nlapiCreateRecord("Vendor");
var field = record.getField("custentity473");
var selectoptions = field.getSelectOptions();
for ( var i in selectOptions) {
var Option = {
id : selectOptions[i].getId(),
label : selectOptions[i].getText()
}
Options.push(Option);
}
fieldDetail["options"] = Options;
But my need is to get source list information like name of the list source (customer or custom_dev_j15_m_list) via suitescript
any idea on how to get this information?
Thanks in advance
I'm not sure I understand this question for what you're trying to do.
In NetSuite almost always, you accommodate to the source list types because you know that's the type, and if you need something else (e.g. a selection which is a combination/or custom selection you'll use a scripted field)
Perhaps you can expand on your use case, and then we can help you further?
I am writing a Bixby capsule and one of the inputs is street address.
One method that I have tried is creating the following structure:
structure (FullAddress) {
description (Address of a house)
property (addressNumber) {
type (geo.StreetNumber)
min (Required)
description (Address Number)
}
property (addressStreet) {
type (geo.StreetName)
min (Required)
description (Street Name)
}
property (addressSuffix) {
type (geo.StreetSuffix)
min (Required)
description (Street Name)
}
}
with a constructor action to put the 3 inputs together.
I have seen that given an address 19 Fake Fields Street the geo.StreetName typed input sometimes is able to understand Fake Fields and sometimes just Fake and drops Fields.
Also Bixby's speech to text sometimes hears app or have instead of ave for the geo.StreetSuffix value which makes it prompt the user for a suffix.
Is there a way to get Bixby to understand a street address with a little more accuracy?
Basically you need more training examples, which include 2 or 3 words as street names. Try to have at least 3 examples with xxx fakexxx fields street, and test in simulator the utterance yyy fakeyyy fields street to see if Bixby can capture fields as part of the address name. The goal here is to train Bixby to learn that there might be 2 or even 3 words ahead of addressSuffix. After that you can try utterance zzz fakezzz creek street without ever using creek in the training to confirm Bixby not just learned fields. Please read more in this article.
There is no easy way when come to speech recognition. You can include a vocab model to force "app" to be "ave", but what if user truly want say the word app or have? I would think the user can type ave or blvd, but need to say the word avenue instead of ave, and boulevard instead of blvd.
Another alternative is to use the viv.geo.SearchTerm in training and viv.geo.NamedPoint in your action. This let a user say something incomplete like "1 Market Street, California" and Bixby will use a HERE maps search to find this in San Francisco.
To use, setup a NamedPoint concept (after importing viv.geo)
structure (InputAddress) {
role-of (geo.NamedPoint)
}
Then in your action, you can do something like:
input (namedPoint) {
type (InputAddress)
min (Required) max (One)
default-select {
with-learning
with-rule {
select-first
}
}
}
In this example, using learning and select-first will automatically select the first address. Without this, Bixby will autosuggest addresses.
namedPoint will then be passed to your endpoint and you can parse as needed.
In training, use geo.SearchTerm - for example:
[g:GetAddressAction] My address is {[g:InputAddress] (665 Clyde Ave Mountain View California)[v:geo.SearchTerm]}
or for a prompt, you could use:
[g:GetAddressAction:continue:InputAddress] {[g:InputAddress] (60 S Market)[v:geo.SearchTerm]}
You can get a more fully formatted address by letting Bixby handle it by using the viv.geo.ResolveAddressByPlaceID goal. Here is a complete action using NamedPoint and ResolveAddressByPlaceID. Note the links to the relevant docs in comments
action (GetAddressAction) {
type(Search)
description (Get Address)
collect {
// See https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.geo#using-searchterm - used in training
// and https://bixbydevelopers.com/dev/docs/dev-guide/developers/library.geo#namedpoint - used below and for computed-input
input (namedPoint) {
type (InputAddress)
min (Required) max (One)
default-select {
with-learning
with-rule {
select-first
}
}
// hidden - Hide if all you need is address
}
computed-input (address){
type (geo.Address)
min (Optional) max (One)
compute {
intent {
goal: viv.geo.ResolveAddressByPlaceID
value: $expr(namedPoint.placeID)
}
}
}
}
output (geo.Address)
}
I´m new to Blockly and can not find a way to obtain field value of a dropdown or checkbox.
Lets consider following scenario (generated with blockly-dev-tools):
Blockly.Blocks['feature'] = {
init: function () {
this.appendDummyInput()
.appendField("Feature") // just for label
.appendField(new Blockly.FieldDropdown([["manufacturer", "feature_manufacturer"], ["profile", "feature_profile"], ["glas", "feature_glas"]]), "category"); // for dropdown values
this.appendValueInput("feature_name")
.setCheck("String")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Name");
this.appendValueInput("feature_prio")
.setCheck("Number")
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Priorität");
this.appendDummyInput()
.setAlign(Blockly.ALIGN_RIGHT)
.appendField("Versteckt")
.appendField(new Blockly.FieldCheckbox("TRUE"), "hidden");
now obtaining values from value inputs is not a problem, you can get thouse like this:
const featureName = element.getInputTargetBlock("feature_name");
if (featureName) {
console.log(featureName.getFieldValue("TEXT"));
}
const featurePrio = element.getInputTargetBlock("feature_prio");
if (featurePrio) {
console.log(featurePrio.getFieldValue("NUM"));
}
but dummy inputs hosting dropdowns or checkboxes have no methods to provide selected values.
It might be that this is my conceptual error to use dummy inputs to host the elements, but when using value input, you have always those nipples to the right, which are obsolate, since the values are provided by the checkbox or dropdown.
You should be able to skip the middleman and use element.getFieldValue. For example, to get the value from the checkbox field named "hidden", you could use element.getFieldValue("hidden").
P.S. You can also skip the element.getInputTargetBlock middleman and use Blockly.JavaScript.valueToCode (I.E., to get the value of the block in the "feature_name" input, you could use Blockly.JavaScript.valueToCode(element, "featureName", Blockly.JavaScript.ORDER_ATOMIC) or what have you). If you use a different generator than JavaScript, replace JavaScript with the generator you use (e.g. Python or whatever).
I struck to pass multiple arguments in define.
The following is my code. I would like to pass two array inside the define, But I'm able to pass only one as like the following.
class test {
$path = [$path1,$path2]
$filename = [$name1,$name2]
define testscript { $filename: } // Can able to pass one value.
}
define testscript () {
file {"/etc/init.d/${title}": //Can able to receive the file name.
ensure => file,
content => template('test/test.conf.erb'),
}
From my above code, I could retrieve the filename inside the define resource. I also need path to set the value in the template. I`m not able to send / retrieve second argument in template.
Is there any way to improve my code to pass two values ( $path and $filename ) inside define resource ?
Any help is much appreciated.
Is there any way to improve my code to pass the two values ( $path and $filename ) inside define resource ?
Puppet has good documentation, which covers this area well.
To begin, you need to appreciate that a defined type is a resource type, in almost every way analogous to any built-in or extension type. If your defined type accepts parameters, then you bind values to those parameters just as you would in any other resource declaration. For example:
class mymodule::test {
mymodule::testscript { $name1: path => $path1 }
mymodule::testscript { $name2: path => $path2 }
}
define mymodule::testscript ($path) {
file {"${path}/${title}":
ensure => 'file',
content => template('test/test.conf.erb')
}
}
Additionally, because defined types are resource types, you should discard the concept of "passing" values as to them as if they were instead functions. That mental model is likely to betray you. In particular, it will certainly give you the wrong expectation about what would happen if you specify an array or a hash as your resource title.
In particular, you need to understand that in any resource declaration, if you give the resource title as an array, then that means a separate resource for each array member, with the array member as that resource's title. In that case, every one of those resources receives the same parameter values, as declared in the body of the declaration. Moreover, resource titles are always strings. Except for one level of arrays, as described above, if you give anything else as a resource title then it will be converted to a string.
I have a Couchdb database with documents of the form: { Name, Timestamp, Value }
I have a view that shows a summary grouped by name with the sum of the values. This is straight forward reduce function.
Now I want to filter the view to only take into account documents where the timestamp occured in a given range.
AFAIK this means I have to include the timestamp in the emitted key of the map function, eg. emit([doc.Timestamp, doc.Name], doc)
But as soon as I do that the reduce function no longer sees the rows grouped together to calculate the sum. If I put the name first I can group at level 1 only, but how to I filter at level 2?
Is there a way to do this?
I don't think this is possible with only one HTTP fetch and/or without additional logic in your own code.
If you emit([time, name]) you would be able to query startkey=[timeA]&endkey=[timeB]&group_level=2 to get items between timeA and timeB grouped where their timestamp and name were identical. You could then post-process this to add up whenever the names matched, but the initial result set might be larger than you want to handle.
An alternative would be to emit([name,time]). Then you could first query with group_level=1 to get a list of names [if your application doesn't already know what they'll be]. Then for each one of those you would query startkey=[nameN]&endkey=[nameN,{}]&group_level=2 to get the summary for each name.
(Note that in my query examples I've left the JSON start/end keys unencoded, so as to make them more human readable, but you'll need to apply your language's equivalent of JavaScript's encodeURIComponent on them in actual use.)
You can not make a view onto a view. You need to write another map-reduce view that has the filtering and makes the grouping in the end. Something like:
map:
function(doc) {
if (doc.timestamp > start and doc.timestamp < end ) {
emit(doc.name, doc.value);
}
}
reduce:
function(key, values, rereduce) {
return sum(values);
}
I suppose you can not store this view, and have to put it as an ad-hoc query in your application.