IBM Chatbot Assistant - How to skip to the next slot - ibm-cloud

I have a node in which I have enabled slots and within the node there are several slots. The first slot asks the customer to provide a specific number. After 3 unsuccessful inputs, I want the bot to automatically skip to the next slot. Is this possible?
Many thanks.

Yes, you can exit or move on after a certain number of unsuccessful attempts of gathering information. This is done using the "Not Found" condition on slots and by adding a counter variable. Check out this example in the docs on "Moving on after multiple failed attempts".
That sample defines this counter (my recommendation: name it differently):
"context": {
"counter": "<? context['counter'] + 1 ?>"
}
Then, in a "not found" condition, you would check $counter > 3. There, in the output and context section, set up another context variable to trigger skipping to a specific node.

Related

How to build OR-behavior into Azure Synapse pipelines?

I have a pipeline in Synapse that reloads data from a number of REST-endpoints. It looks as follows:
What I want to achieve is that the 'CheckAccessTokenValidity' activity checks whether my API-token is still valid. If yes, all is fine, proceed to ForEachDivision activity. If no, refresh tokens, Proceed to ForEachDivision activity.
I thought I had implemented this logic in the screenshot provided. However, this is not the case. My pipeline is now deadlocked because the ForEachDivision apparently expects all three preceding activities to be succesful before running (Which is impossible by design).
How do I implement the logic described above in Azure Synapse?
You can modify your pipeline and accommodate following changes:
Create a variable 'var1' , by default set it to 'False'
After 'CheckAccessTokenValidity' , add set variable activity 'set variable1' pointing to 'var1' and set its value as 'True'
After SetRefreshToken , add another set variable activity 'set variable2' pointing to same 'var1' and set its value as 'True' , so that either of the step 2 or 3 can turn the value of variable to 'True'.
Remove all activities starting ForEach block from this pipeline and cut paste those activities and keep in another new pipeline 'pipeline2'
After 'set variable2' activity, attach an If activity with 'success' and 'Skipped' conditional path . If step 2 gets successful, 'set variable2' would be skipped and it will call the next activity that is 'Step6' . If step 2 fails, and step 3 is called, it will call 'set variable2' and after its success, Step6 will be completed.
In this if activity, write the condition to check the value of var1 . If var1=='True' , then execute the 'pipeline2'

How can I submit unsubmitted Moodle attempt via SQL

Hello I ma trying to submit unsubmitted quiz attempts so I can grade them. So far I have set the timefinish column in mdl_quiz_attempts which changes the attempt status to "Not yet graded", then setting fraction to 0 from NULL and state to "gradewrong" from "complete" in mdl_question_attempt_steps to simulate submission but this seems to break the site. What am I missing?
You're going to have to trace through the code for the process_finish() function in mod/quiz/attemptlib.php ( https://github.com/moodle/moodle/blob/master/mod/quiz/attemptlib.php#L2171 ) and figure out how that all works.
This is a complex process and will require a lot of DB queries / updates in order to achieve it manually.
I would strongly recommend that you write a PHP script to do this, instead of trying to handle it manually (that way you can create an instance of 'quiz_attempt' for each user's attempt, then call $attempt->process_finish() on each, in order to close the attempt properly).
Thanks. The trick is to set the timefinish column in mdl_quiz_attempts which changes the attempt status to "Not yet graded", then setting the state to "gradewrong" from "complete" in mdl_question_attempt_steps for unsubmitted responses to simulate submission. Then set a fake 0 grade to sumgrades where grades are NULL in mdl_quiz_attempts and then running a regrade in the admin panel.

Using QCMDEXC to call QEZSNDMG via DB2 stored procedure

Working on a side project where I use a set of views to identify contention of records within an iSeries set of physical files.
What I would like to do once identified is pull the user profile locking the record, and then send a break message to their terminal as an informational break message.
What I have found is the QEZSNDMG API. Simple enough to use interactively, but I'm trying to put together a command that would be used in conjunction with QCMDEXC API to issue the call to QEZSNDMG and alert the user that they are locking a record.
Reviewing the IBM documentation of the QEZSNDMG API, I see that there are two sets of option parameters, but nothing as required (which seems odd to me, but another topic for another day). But I continue to receive the error "Parameters passed on CALL do not match those required."
Here are some examples that I have tried from the command line so far:
CALL PGM(QEZSNDMG) PARM('*INFO' '*BREAK' 'TEST' '4' 'DOUGLAS' '1' '1' '-4')
CALL PGM(QEZSNDMG) PARM('*INFO' '*BREAK' 'TEST' '4' 'DOUGLAS')
CALL PGM(QEZSNDMG) PARM('*INFO' '*BREAK' 'TEST' '4' 'DOUGLAS' '1')
Note: I would like to avoid using a CL or RPG program if possible but understand it may come to that using one of many examples I found before posting. Just want to exhaust this option before going down that road.
Update
While logged in, I used WRKMSGQ to see the message queues assigned to my station. There were two: QSYS/DOUGLAS and QUSRSYS/DOUGLAS. I then issued SNDBRKMSG with no affect on my workstation (IE, the message didn't break my session):
SNDBRKMSG MSG(TESTING) TOMSGQ(QSYS/DOUGLAS)
SNDBRKMSG MSG(TESTING) TOMSGQ(QUSRSYS/DOUGLAS)
I realized if I provide the workstation session name in the TOMSG parameter it worked:
SNDBRKMSG MSG(TESTING) TOMSGQ(*LIBL/QPADEV0003)
Using SNDBRKMSG was what I was looking for.
Some nudging in the right direction lead me to realize that the workstation session ID is located within QSYS2.RCD_LOCK in field JOB_NAME (job number/username/workstation).
Extracting the workstation ID allowed me to create a correctly formatted SNDBRKMSG command to QCMDEXC and alert the user that they are locking a record needed by another process.

Anylogic is assigning the value to all entities instead of only one

My source has the following code in "On at exit" field:
TRUCK.ID_number = parameter;
parameter = parameter + 1;
Then, each truck will receive an ID: 1, 2, 3, ...
The problem is that All the trucks are circulating at the same time and it looks like everytime a new truck is generated and the code runs it resets the ID for all trucks.
For example: When truck 4 (ID = 4) is created at the source all the other trucks receive ID 4 so I cannot know the correct ID of each truck.
What am I doing wrong?
a few things. First, you need to use the keyword agent in the onExit code box. So in your case, agent.ID_number=parameter. Please read up on these specific keywords that pop up everywhere in AnyLogic code boxes. I call it the "magic lightbulb", also see my blog on that topic:
The magic lightbulb
Second, newly created agents automatically get a unique index (if they belong to the same population). You can access that using the getIndex() method inside your truck agent.
The answer is: Use entity.ID_number=parameter

Detect a number in entity in IBM Watson Conversation

I need the user to input his flight number in order to fetch its details for him.
Is there any way to detect and store the flight number (3-4 digits + words) that he entered?
I know that I can create an entity in order to store some parts of the user inputs, but it seems like I have to hard-code values which I want to retrieve, which is not practical.
So, is there any option to make watson automatically detect a part of user input (not limited to numbers).
In your condition section you can put in the following.
input.text.matches('.*?[0-9]{3,4}.*?')
For your output area, go to advanced mode and do the following.
{
"output": {
"text": "You typed a 3-4 digit number. I stored it in Context variable 'found'"
},
"context": {
"found": "<? input.text ?>"
}
}
You can then query the context variable found in your code to do more complex actions on it.
Conversation has been updated since this answer. You can now use input.text.extract() instead of just input.text.
Like so:
"found": "<? input.text.extract('.*?([0-9]{3,4}).*?',1) ?>"