I have list of values defined in the values of array inside the text element.
Now, when the value of the aray is "Counting finished" I would like to route the flow to new node and pass some text to the user. How to achive the condition?
As that is output text the conversation tree can't see it unless you put it into the input or a context variable, and send it back into the tree.
The easier option is to create a counter. There is more details and an example conversation file here:
https://sodoherty.com/2016/09/22/using-counters-in-conversation/
Summary:
You create a context variable like countdown for example, and set it with a value to countdown from.
Then in your input text you can add the following code to initiate a decrement.
<? context.countdown-- ?>
This will be outputted though, so you can use a continue from to jump to another node which has append set to false. This will erase the counter from being displayed.
Optionally you can set the context variable directly like as follows.
{
"output": {
"text": "Decrementing countdown counter"
},
"context": {
"countdown": "<? context.countdown-- ?>"
}
}
This had issues in earlier versions of conversation though. I believe it should work now without issue.
Related
I am getting the keys of an object from an API response like this
"subscriptionDetails":
[
{
"subscriptionKey":"Mobile Number",
"dataType":"NUMERIC",
"isMandatory":"M",
"length":8
}
]
keys can be more than one. I have entered some value for mobile number. On click of a button i want to clear the value which i have entered by keeping the keys. I tried few things like below but none worked. Kindly help.
this.set("subscriptionDetails.subscriptionValue", undefined);
this.set("subscriptionValue", undefined);
Your object contains an array in which objects are stored, hence the [ and the {.
Therefor subscriptionDetails.subscriptionValue wont work since you need to reference the array first like:
subscriptionDetails[0].subscriptionValue
Furthermore your data contains no 'subscriptionValue' but seems to contain a 'subscriptionKey'
I want to filter data from my Firebase database to only list jobs with the authUser equal to the current signed in user.
I have utilized .orderByChild method to filter out the data. However, I cannot figure out why looping into the snapshot to get individual values does not work.
Here is my component where I want to list all jobs that meet this criteria.
Jobs Component code
Also, if I do console.log to preview the data being received, it looks like this. Is this not okay?
Console output
Here is my Firebase data structure. There are no explicit rules defined.
enter image description here
I am fairly new to Vuejs.
After adding self.myJobs = snapshot.val(), my console output looks like this:
updated console output
Can you try something like this ?
let vm = this //define this variable before the cursor definition
// comment the snapshot.forEach section and replace by
vm.myJobs = snapshot.val() //or any variable containing the jobs
Adding on to #Farouk Mekkaoui's answer, inside your v-for you need something like this:
<li v-for="job in myJobs">
{{ job.name }} //any or whatever property you want to access...
</li>
EDIT:
Do not comment out snapshot.foreach loop.
snapshot.foreach(function(data){
this.myJobs.push(data.val().name)
}
we'd like to keep user on the same prompt when they enter the wrong number, we have tried anything_else, and "true", "jump to", but it messed up, please take a look at the attached to reproduce it, Thanks
pleae enter "how much"
if you enter 6, it will lock the prompt(I assign 1 to 5 to different identification), this behavior is correct .
then enter 2, we will get messed up...
please import this json to reproduce it, thanks
https://drive.google.com/file/d/0B1YdUMoS4l7ub1BZdUg1c1dQeG8/view?usp=sharing
The better form is use the entitie pre-defined by IBM, #sys-number to get numbers from the user input. And you can use use with conditions and to get the number with context variable too, check the JSON example:
{
"context": {
"number": "<? #sys-number ?>"
},
"output": {
"text": {
"values": [
"Now is $hora. Sector please?"
],
"selection_policy": "sequential"
}
}
}
If user type two or 2, the entitie recognize!
You can use regex expression to obtain only the numbers you have pre-defined too!
How to active: -> Entities -> System Entities -> sys-number = ON:
Obs.: Waiting Watson TRAINNING after you active this entitie.
Example, with sys-number add in your node condition:
#sys-number:1
Check the image:
If user type the number correct:
Check the dialog if user dont type the correct number with true condition:
I did the example for you understand what I do for that:
Download the JSON for verify how to do it with REGEX here.
Download the JSON for verify how to do it with SYS-NUMBER here.
EDIT:
Refer your questions
In this case you can use regex, and use the context variable for make conditions in other node. My workspace with regex can help you with numbers. And, the variable $number you can use in the next node to verify if the user typed correctly the number.
And, the other case is to use the Jump to inside conversation. And use true if the user dont type the number correctly again.
Check my image:
Download the new workspace here.
Study more about conditions here.
Taking the car dashboard example, I altered the initial #genre node to be #genre:classical. I also added a list to the contex
"choices":["Beethoven","Mahler 9","Brahms 3rd"]
and the Watson response is "I have 3 selections". The condition on the next node is $choices.contains(input.text). The "Found a match" response is just for testing. It looks like this:
When I test this in the api tool and type "Beethoven" both "Found a match" and "Great choice!..." appear. Same for the other two choices, but only if I type the exact choice, e.g., "Mahler 9". Typing "Mahler" or "mahler" doesn't get a match. I read through the SpEL documentation but couldn't see a way in a one-line condition to parse through the list looking for partial matches.
So my question is, is there an condition expression that would match partial user input, e.g., "Mahler"? I'll be using the Java SDK to code the app server, so alternatively I wondered if I could add a temporary #entity just for this sequence instead of using the context list then delete it when the conversation is done? Or is there a way to construct a more complex condition in the MessageRequest and will Watson recognize it? Or is this just not the right way to go about this? Any pointers, examples or docs much appreciated.
So my question is, is there an condition expression that would match partial user input
You can't add temporary entities or intents. As adding them forces Watson to start training itself (even if you could it through code).
You can however create quite complex regular expressions, pass them in as a context variable.
For example your advanced node can have:
{
"output": {
"text": "Please ask me a question."
},
"context": {
"rx": "fish|[0-9]+"
}
}
Then in you condition you would write.
input.text.matches(context.rx)
This will then trigger if the person mentions a number, or the word fish. So you can create your partial user input checking that way.
I have 2 correlated incoming messages from 2 different systems (SystemA and SystemB) and I just want to basically copy over a couple fields from the SystemA message to the SystemBmessage.
So my Construct Message shape looks like this:
The Message Assignment shape just has this code inside it:
xmlIncomingNoAttachHolder = new System.Xml.XmlDocument();
xmlIncomingNoAttachHolder = msgMultiPartInNoAttachment.BodySegments;
// assigning the SsytemB version (no attachment) first.
// Also, since we are only copying a couple fields, this can serve as the base.
msgComboWithAttach = xmlIncomingNoAttachHolder;
msgComboWithAttach(XMLNORM.TargetCharset) = "UTF-8";
The map then just has the 2 input (SystemA schema and SystemB schema) ORU messages on left and the output ORU message on the right, which also shares the same schema as the SystemB input message.
My hope was that I could just use the message assignment code above to assign the Output msgComboWithAttach message, then use the mapper to map over the few fields that we need from the SystemA message to the SystemB message.
But it seems that as soon as I apply the map, it clears the pre-loaded msgComboWithAttach message before performing the transform and then applies the map. The resulting message then contains ONLY those fields that are copied over in the map and none of the other segments/fields that were assigned in the message assignment pre-load.
Is this expected behaviour, in which case, I would have to do a Mass-Copy on all the segments in the Map? Or is there a way to pre-load/copy the message like I want and then only Map a couple fields over?
Yes, that is the expected behavior since the transform will create a new message. You cannot use Xslt to modify a document in that way.
Dijkgraaf's solution will work. As an alternative, you can use the Orchestration xpath() function to read and set specific values in Message. See: http://msdn.microsoft.com/en-us/library/ee268159(v=bts.10).aspx
Yes, that is expected behaviour.
What you want to do is
Distinguish the fields in the schema(s) (target and source, in your case they may be the same one if I understand what you are saying).
Have the map first making sure that your map creates the fields you want to populate with some dummy values.
Have an assignment shape after that just has one line for each of the fields in the format msgDestination.record.field = msgSource.record.field; (Note: you might have multiple levels of records).
This works only for non-reoccurring fields. For reoccurring fields you need to use a multi-part map instead.