Repeating an intent causes slot validation to consider previous value - watson-conversation

I have an #StartTest intent which expects a #Test entity (user examples: "Start test", "Start #Test") , then I created a slot that checks if #Test has been provided ($Test variable), and if not, it asks for it.
The problem is that if I type "Start test", provide the test name, and type "Start test" again, it considers the previous $Test value in the condition, thus considering it as already provided.
How can I ask for a new value for $Test if the user send "Start test" again?

Solved by adding a child node and setting the variables in the Context Editor or JSON Editor.

Related

How to get the clicked choice in the closing form dialog?

When I close the Form appear this DialogBox
I need to get the action clicked in this dialog (for example Yes or No etc...) in Form's method canClose
In debug the last point is in:
\Forms\MyForm\Methods\canClose
ret = super();
How I can get the clicked choice?
Thanks in advice.
You cannot get the answer from the prompt.
The return value of super is true, if the user can leave the form.
You do not describe what you want to achieve, but "No" is the answer to your question.
The prompt comes when a value in the record is change and the users press the Esc key. If the user selects Yes, the write method is called. So you may set a flag canClose and then test it in write. But I honestly not see the reason why this would be useful.
Check some lookup and dialog forms.
They uses closeOk, closedOk, closeCancel and closedCancel methods.
There are also closeSelect and closeSelectRecord methods to assign selected record (check also selectMode method on the form).

In Watson conversation service, how to prevent from matching to the wrong intent, example is included

I have a simple flow where I want to give the response based on the input to an entity ( in my case #language). Why is the response mapping to an intent ?
The issue is with the second condition you have created.
#language:java AND #how_to_develop
When the user enters in the text "Java", the intent of the text is checked again. Because the intent is different, it will never hit that node.
You can solve this by just setting your condition to:
#language:java
As you have already detected the earlier intent.
In your application, you can stop the second response from doing an intent check by passing back the intents[] object from the previous call.

Updating with ScriptManager.RegisterHiddenField

I'm trying to update a hidden field created with...
ScriptManager.RegisterHiddenField(page, fieldName, initialValue);
When the page posts back to the server the field is already registered, calling ScriptManager.RegisterHiddenField again seems to append to the field. e.g.
On the first request...
ScriptManager.RegisterHiddenField(page, "MyHidden", "foo");
Page posts back and you make a second call...
ScriptManager.RegisterHiddenField(page, "MyHidden", "bar");
Value of the hidden field becomes "foo,bar".
I would prefer the value to be "bar". Is there a way to do this?
UPDATE: The normal behavior should result in the second call setting the hidden field to "bar". I've yet to determine how to replicate this issue. I should change my question to. Has anyone observed this behavior?
It contains only one value at any point of time:
if(!IsPostBack)
ScriptManager.RegisterHiddenField(this, "MyHidden", "foo");
else
ScriptManager.RegisterHiddenField(this, "MyHidden", "bar");
Output is "foo" and after postback it's "bar".

Update Gridx with JsonStore, on event?

I am new to Web UI, Dojo, Java etc. If you are referring any advance topic please give some reading reference. It will help.
Context:
I have Gridx design using JsonStore, which takes a target + id for URL. With fixed "id" Grid loads well.
I have Dynamic Tree. It is working fine with lazy-loading etc.
Objective:
Based on click (or dblclick) event for a given node in Tree, I have to load Gridx with data. Hence, if tree node "id":7 is clicked, then JsonStore: /target/7 should be fetched and get loaded in Gridx.
Issues:
As you can guess, at start there is no valid "id" property to fill in JsonStore. In click event handler of tree, I will get this value, upon a user click. Hence, can't call gridx.startup() in "ready". Though I have "placed" the widget in "ready".
Hence, I have following snippet to handle,
<
// this function is called from tree event handler
function LatestTabGridxLoad( id ) {
console.log( "ID %s fetched.", id );
LatestTabGridxStore.idProperty = id;
LatestTabGridx.startup();
LatestTabGridx.body.refresh();
}
ready(function()
{
TabLatestAssetTree.startup();
LatestTabGridx.placeAt( "ReportMiddleTabLatestCenterContainer" );
}
Now, trouble is, at first time loading, JsonStore GET fired with /target/ alone, without any "id" without any user click. Hence, server responds with 405. Subsequently, when user clicks, again same HTTP GET without "id" results in HTTP 405. I am not able to somehow feed "id" to the GET URL. I have checked JSON, it is in perfect shape, as it works in standalone table, that is declarative(ly) defined.
Please suggest me ways to link a TREE node through its "id" to Gridx. Also suggest, if approach I am taking is right way to solve this problem.
Sorry, misunderstanding of the question. I thought it was about gridx tree but it is about regular gridx controlled by another widget.
The problem is in this line:
console.log( "ID %s fetched.", id );
LatestTabGridxStore.idProperty = id;
'idProperty' is the name of the JSON attribute which stores the ID. This will not change with each selection. If it is not set, JsonStore will assume it to be 'id'. What you intended to do was to modify the target property of the store to include the ID. This can done directly and will look something like the following (details are application specific)
LatestTabGridxStore.target = (someURL) + '/' + id;
After that, the content of gridx needs to be replaced using the new store setting. There are few ways to do it, the simplest being destroying the current gridx instance and replacing it with another one which uses the altered store.

Is there any system(application) variable in Qt which keeps track of whether the application is being used first time

I wan’t to display a message, only on the first usage of application, i.e. a piece of code should be executed only once, when application is first time invoked. I tried using QSettings, but couldn’t work out any way.
if(firstTime)
{
//do something!
}
Just check QSettings for some value at launch. If it doesn't exist, then its a first launch. After that, set the variable so it will be found each subsequent load.
In PyQt4 it would look like this (I am sure you can translate to C++):
settings = QSettings("foo.plist", QSettings.NativeFormat)
if not settings.contains('hasLaunched'):
# this is our first time! Weee
# no matter what, set the value for the future
settings.setValue('hasLaunched', 1)
instead of "hasLaunched" you may use "lastLaunchedVersion" and store there version number. This way you may easily do some vesion specific steps on each upgrade if they are required and also detect first launch.
In cpp:
// Setup the QSettings variable
QSettings settings("Organization", "ApplicationName", this);
// Check if the value for "firsttime" is set,
// and add default value to true
if(settings.value("firsttime", true).toBool())
QMessageBox::information(this, "Hello", "This is our first time");
// Set the value to false, because from now on its not the first time
settings.setValue("firsttime", false);

Resources