first of all, I'm using Voice Agent with Watson Assistant, so everything here is in a phone call with Voice Agent.
I'm having trouble when prompting my users for their 'ticket' code for me to call my external API to get the status of the ticket. The problem is that the number is always a "big" integer, in this example: 123, so they don't speak it like: one hundred and twenty three, they say it like: one two three (and these values are sometimes more than a thousand). Then my #sys-number get this values:
#sys-number:1
#sys-number:2
#sys-number:3
This cause my sys-number to get only "1", because it was the first digit it recoginized. Is there a way to merge these values into one single variable?
Screenshot attached of the example dialog:
You can use the following to convert the entity to a comma delimited array.
<? #sys-number.values.join(',') ?>
Related
What is the correct API syntax for using the custom_file_ids[] query parameter to specify multiple fields (but not all) in the CLIO API contacts result set? I need to specify multiple custom fields. I can get it to work for a single field, but not multiple fields at the same time.
Specifically, how do I specify and delimit the multiple fields? I have tried the following:
custom_file_ids[]=1234567,2345678
custom_file_ids[]=[1234567,2345678]
custom_file_ids[]=(1234567,2345678)
custom_file_ids[]={1234567,2345678}
custom_file_ids[]=1234567:2345678
The API documentation at https://app.clio.com/api/v4/documentation is silent on the list syntax that it expects.
Below is one specific API call I tried (both the actual URL-encoded call, and a decoded one for clarity) using a simple comma-delimited list, but which only returns custom field data for the first ID in the list--not the second. If I enclose the ID list in any kind of brackets (per above), the endpoint returns a 404 error.
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567%2C2345678&custom_field_values[4529224]=true&fields=id%2Cname%2Cprimary_address%2Cprimary_work_address%2Cis_client%2Ctype%2C%20primary_email_address%2Cprimary_phone_number%2Ccustom_field_values%7Bid%2Cfield_type%2Cfield_name%2Cvalue%2Ccustom_field%7D
https://app.clio.com/api/v4/contacts?custom_field_ids[]=1234567,2345678&custom_field_values[4529224]=true&fields=id,name,primary_address,primary_work_address,is_client,type,primary_email_address,primary_phone_number,custom_field_values{id,field_type,field_name,value,custom_field}
Try:
custom_file_ids[]=1234567&custom_file_ids[]=2345678
I was able to do this with Contacts Custom Fields by putting custom_field_id[] on the URL as many times as you have IDs.
I hope this helps.
I have an Entity
#City = Austin, Providence, London and Boston
I simply want to answer the question what cities does this bot work with?
And then respond with:
Here are the cities this works with $Locations , Which city do you want?
In the dialog, you have access to all the entities that were detected (recognized) in the user input. However, you do not have access to all the defined entities and their possible values.
What you could do is to define a context variable with the allowed values. That variable could even be dynamically populated (see this tutorial for database access from within Watson Assistant). Another option is to hardcode the response. But this only works well with few values and infrequent changes.
I am trying to clean up throughout columns within a table to create a clear attribution/reference for reporting on my digital marketing campaigns. The goal is to keep one part of a string while deleting all others. All strings within my marketing campaigns have symbols separating each substring.
Attached are pictures of my current table and of the desired table.
I am essentially trying to only keep on part of the structure of a string and delete all other sub strings. I have already managed to do this successfully by applying the following formula given to be from a separate thread.
update adwords
set campaign = substring(campaign from '%-%-#"%#"' for '#')
where campaign like '%-%-%';
This worked perfectly, however, I do not fully understand why and have not found a clear answer thus far on this forum.
How would I apply this to future rows? Ad group and match type can be used for this purpose.
Many Thanks.
First thing: You do not modify source data. Do ETL instead, and transform it to a final stage. Do that periodically and thus taking care of new data.
You could just create a trigger which should work for all new data, but there are 2 caveats with that:
Failure will lead to missing data and you not being able to QA it.
If you modify the source data in an incorrect way by mistake, you cannot undo it unless you have a backup, and even then it's just too hard.
So instead look at ETL tools like Talend or Pentaho Kettle; create your own ETL scripts, or whatever. Use Jenkins to schedule all of this periodically and you're set.
Now, about the transformation itself.
for '#'
indicates that # will be an escape symbol, which means that #" will be treated as a regular quote in this case.
substring(campaign from '%-%-#"%#"' for '#')
thus, selects everything between the quotes in the pattern. % is a wildcard, same as used in LIKE comparisons. So everything in the last group will be returned. This can better be done with regular expressions
substring(campaign from '.*?-.*?-(.*)')
For the second column the regex would be ^(.*?)\s*\{
And for the third one - similar: ^(.*?)\s*\}
I would create the new table like this:
CREATE TABLE aw_final AS
SELECT
substring(campaign FROM '^\w{2}-\w+-(.*)$') AS campaign,
substring(ad_group FROM '^(\w+)\s*\{\w+\}$') AS ad_group,
substring(match_type FROM '^(\w+)\s*\}$') AS match_type
FROM adwords
WHERE campaign ~ '^\w{2}-\w+-(.*)$'
But if you must do an update, this would be how:
UPDATE adwords SET
campaign = substring(campaign FROM '^\w{2}-\w+-(.*)$'),
ad_group = substring(ad_group FROM '^(\w+)\s*\{\w+\}$'),
match_type = substring(match_type FROM '^(\w+)\s*\}$')
WHERE campaign ~ '^\w{2}-\w+-(.*)$'
Is there a way in forms-mode, to have multiple different "forms-format-lists" which depend on
the record currently being read into the buffer? For example, say I have 5 different types of
records in my file, all with different fields, but each record type is categorized by say field
number 1. Is it possible to define based on the value of a field number, which form is loaded for
a particular record? i.e. a file with both student and teacher records, and field number one starts
with either "T" or "S". If it begins with "T", load the teacher's form, else the student one.
Probably working with temporary files is closest to existing code.
Create forms-student.el resp. forms-teacher.el matching your data-types.
Than a command for traveling source code, (when (looking-at... ) - which writes a teacher-temp or students-temp data. Afterwards call forms-teacher.el resp. forms-student.el upon them accordingly.
Writing temps might be avoided, which needs some more tweaks, reading from buffers, not file etc.
I want to develop an app that gives a random quote every time you change the page. And I want to put like 1000 quotes in the database. How is the best way I can get a Random Quote? arc4random?
To extend the answer you were given on selecting a method to generate a random number - choose a random number method, and have an index for each quote in the DB so that you can query a quote directly from the random number you compute.
Also you can get counts directly from Core Data (without doing a real query) to figure out the range of random numbers you want to ask for.