Watson Assistant Chatbot saving user inputs in Slots - ibm-cloud

I'm using Watson Assistant Chatbot..I want to save a variable from the user input by enabling Slots and system entities like #sys-number.. I can save number by choosing check for #sys-number, or saving date by choosing check for #sys-date... But for text/characters I can't find something like #sys-text or #sys-char..
I tried to save text while check for #sys-number, but the answer is not saved into the variable and the question keep repeating in th chatbot console.
So, how can I use Slots to save text from user input, I mean what should I put in "check for", please?
Thanks,

Numbers are always numbers, no matter your language and context. Dates are always dates as well.
However, "texts" can mean many different things, and they depend on context. That's why you need to create a separate entity for each meaning in your context.
For IBM Watson Assistant, there is no reason to detect "any text" unless that text means something in your context.
Supposing you want to detect the word "smartphone". For Assistant, there is no reason to detect this word if it doesn't relate to any entity.
So, you need to create an entity (e.g. "#Product") and then give it a value named "smartphone". Then, whenever a user types "smartphone" in your Chatbot, Assistant will be able to recognize "#Product:smartphone".
In your Slots, in the "Check for" field, you can put "#Product". It means that if Chatbot doesn't detect any #Product (e.g. "smartphone"), it should repeat the question until it finds a valid product.

Related

SuiteScript or Workflow to turn on/off auto-generated numbers

I have a division that imports invoices into our NetSuite environment using the CSV import function. Works quite well, however, our other divisions within NetSuite require Auto Generated Numbering to be turned on WITHOUT override capability. This means, every time the csv import is ready, I as the admin, must turn on 'allow override' and then allow them to import. Then turn off the override when they communicate they are finished. The purpose of the override is to keep the invoice sequence the same as the authoring invoice. We can then track the invoices in each system. The question is, has anyone every attempted to create a script or workflow to allow the user to turn this function on/off for importing? Is this even feasible?
Let me know your thoughts!
Thanks,
Brad
I'm not aware of any way to do that and in my experience (21 years of Netsuite) this sort of effort generally doesn't scale.
If the document number you are trying to import matches another transaction's document number then what tends to work is to create a custom transaction body field of type list/record -> transaction and populate that with the cross reference in your import.
If you are just trying to maintain a reference to another system's invoice numbers then create a custom transaction body field of type text (or integer) and make it globally searchable (that's a checkbox on field setup). Import your external reference to that and edit that division's forms to show it under the Netsuite generated document number. Users can search transactions by the external reference. It can be shown on pdfs etc etc.

IBM Watson Assistant - how to use input.text inside Slots

I am using IBM Watson Assistant for a chatbot. I have a dialog node with two slots. The first slot works fine. The node gets triggered and the bot asks for the first slot, since it is not present.
Then I would like to have the bot asking for the second slot. And the answer given should be stored in a $variable. I tried to achieve this with input.text, because I want to store every kind of input given there.
But instead of asking for the second slot the bot skips it and stores the answer given in slot one in the slot two $variable as well.
I guess it's because the bot also checks if input.text is present in slot one. To make it clear, I have not activated the 'prompt for everything' option.
How can I overcome this?
I am sure these screenshots of my test environment will make everything more clear:
This is because input.text as a check matches all input, so no matter what you enter your second slot will always be satisfied.
The way slots work is that it doesn't matter in which order the information is given or how much is given.
For Example: Say I have an ordering system looking for 'product', 'quantity', and 'delivery date'
The request 'I want spoons for the 3rd Feb'
Then two of the slots 'product' and 'delivery date' are satisfied and the output response will be for the prompt for the missing 'quantity' slot.
In your case you need to determine what information you are trying to gather. Is there an entity or an intent that is going to uniquely match the input. If so then you could use a slot. As a brute force match you can make the condition for the second slot more complex.
For example when looking for confirmation of an order you can add in the condition, which only triggers when all above slots have been completed, and you are looking to confirm whether you collected the instructions correctly.
(#yes || #no) && slot_in_focus
If this kind of approach doesn't fit your application then you should gather this information after the node for the slots.

Bluemix Conversation, advancing the conversation

I have two conversation nodes defined. The first is triggered on conversation_start and asks the users's name. The second stores the user name from input.text in a context variable and asks if the user wants to take a brief survey or do something else. The second one never executes. What should the trigger be on the second one in order to advance the conversation? There is no intent or condition set yet. Basically, I just want to follow a string-of-pearls pattern where every question gets asked and let the user opt out of some of the questions.
there are two main ways to achieve this. The one I recommend is to create an intent for each possible way. For example, you could create an intent called #affirmative, with values like "Yes", "Yeah", "Sure", "Ok", etc. All you have to do is to create the intent and then use it in the condition field.
But you can also check the user's input directly, using input.text. For example, you could use input.text.toLowerCase() == 'yes' as the condition. Have in mind that this should only be used if you are controlling the input and only allowing a few possible values. If not, use an intent and let Watson Conversation handle the input parsing for you.
Another really cool feature that Watson Conversation provides that can benefit is you is to have a node with a condition like intents[0].confidence < 0.6 and a response like "Sorry, I didn't get that". That way you make sure your flow will only trigger a condition with a high confidence for the intent.
Hope it helps!
You can use the jump to function to route the system to arbitrary dialog_node - this is great for creating directed dialogs. So whenever you want to continue with the next question (user answered the previous question), you can use jump to from the node processing the answer to the previous question to ask the user another question (jump to the body part of the next dialog node asking new question).
Now for "get name" use case you want the second node gathering the name from the user input hanging off the conversation_start node. If the conversation encounters a node that has children, the processing of the next dialog round will start at the first child of this dialog node - this way the contextual dialogs are defined in the conversation.
Bluemix Conversation can be thought of as a state machine. Each transition is diagrammed in the tooling, but each node can only be triggered by a condition. So that if you're on a node asking a question, and the answer that comes back does not trigger one of the child nodes, the state will not transition to a child. Answers entered into a node are processed by Watson, who provides "intents", which are essentially keywords found in the sentence he just analyzed. So one way to advance the conversation is to match named "intents" using the # prefix to the trigger of in a child node. Another way it to match named "entities" using the # prefex, although it is less clear how Watson builds entities. The third way is to match context variables using the $ prefix and simple conditional operators such as ==. Context variables are entirely managed by you, the developer. You are allowed to set one context variable at each node. And then you can use it to trigger a child node. This appears to be a good approach to managing the type of conversation I want to implement. The fourth way is to use the previous parent node's input value using along with simple conditional operators.

how to put more than 1 record in an oracle apex form?

I have a problem with oracle apex forms.
The problem is that I want to add more than 1 record at the same time in 1 form. I have already read that the best way to do that is to use an csv file but then there is no tutorial to do that.
Oracle is a database, and combining files with databases is always tricky and not extensively supported for obvious reasons. Storing files and presenting them for download is one thing. Getting an Oracle database to open a file and reading and processing the contents is another. It sure it possible, but especially combining this with an Apex application I think you are going to run into a lot of challenges such as security restrictions.
However, stepping away from files does not necessarily mean stepping away from CSV. You could simply offer a large text input on your page in which a user can copy-paste a large CSV string. This can then be submitted and processed by the database. To do this you would probably need to create a process that gets fired after you submit the page. From this process you can parse the CSV data and insert multiple rows in a table. The same can be done for things like XML or JSON.
However, who is generating this CSV? Requiring a user to construct CSV is not very user-friendly. It can be complicated and error prone. If the CSV is generated by another application, isn't there a way to circumvent Apex and pass the CSV to the database directly?
If a single text-based data carrier is not required, which I doubt reading your descriptions, why not simply keep your form but allow the user to submit multiple forms? Would if be sufficient to insert one record per submit, and later using a batch to query these records and start formatting one at a time?
If you simply want the user to be able to enter multiple machines without having to submit the page for each machine, this is also possible, but you will have to leave some standard Apex functionality behind and implement some more custom javascript and PL/SQL functionality. Apex only allows a static amount of page items, which needs to be defined design time. So if you want to dynamically add fields such as text boxes and select lists to your page, you will have to resort to javascript. You could start by defining a region which renders one row of input fields at page load, and create a link under it saying 'add another row', which will render a new row of input fields under the existing one, and repeat this as many times as the user needs to.
That takes care of the UI. Now when the user has entered all the data he wants, we need to submit all this data and get it into the database. So yes, at this point we would probably have to get all this data from the input fields and turn it into one single string. This would all have to be done client side in your javascript code. You can then use the Apex page item API to assign this generated string to a single page item, using the $x(...) or $v(...) functions. Then submit the page, at which point the page processes will be fired. You then define a page process which will parse the data in your page item, and use that data to insert multiple rows in the database.

Handling From and To Range Field Values

Say for example I am getting a range of integers from a user:
Generate between nnn and nnn widgets.
Yes, most users will ensure that the first number is equal to or less than the second number:
Generate between 3 and 7 widgets.
But then there's that user, who wants to enter this data "back to front";
Generate between 7 and 3 widgets.
Do you quietly switch the fields around when the user clicks OK/Apply so, in the example above, you change the range of 7 to 3 back to 3 to 7 in the GUI? This might not be so practical on a web form where the user enters some data and then submits the form never to see it again but I'm thinking more in terms of a desktop application's settings page where the user's input is saved and subsequently viewed and edited again by the user.
Is it more important to try and educate users to enter a range that "makes sense" via error/alert messages, or quietly cajole their entries into the shape an application is expecting?
I suspect the "cajoling option" is more preferable, but could this "hey the program messed with my data!" approach be a problem for users?
I am currently writing an application that has a handful of these user-configurable ranges so I'm very interested to follow the general consensus of the SO experts.
If the user enters data incorrectly you shouldn't assume a particular pattern of error and automatically correct it. Either report the error to the user and ask them to correct it or suggest a correction that they can approve. In your example, what if the user intended to type 7 and 13 but simply mistyped. If you changed it to 3 and 7 you've entered incorrect data without the user's knowledge. I'd probably do the simple thing and use a visual alert when incorrect data is entered (but before it's actually submitted) and refuse to accept incorrect data, returning an error if it is submitted incorrectly.