How can I define Slot Priority for Slot Values in an Intent in LexV2 - amazon-lex

I am trying to build my Lex Bot but receiving this error message
Details Recommended action Slot ids [NumberTwo, Number] don't define a slot priority. Update the intent to add a priority to these slots. - Slot ids [Number] don't define a slot priority. Update the intent to add a priority to these slots. - Slot ids [Answer] don't define a slot priority. Update the intent to add a priority to these slots. - Slot ids [Number] don't define a slot priority. Update the intent to add a priority to these slots. -
I am using AWS SDK for Lex with Python to create the bot.
How can I update the intent to add slot priority for my slots?

Answered here https://repost.aws/questions/QUB4WaCne6QxOntq1-R6LtlQ/how-can-i-define-slot-priority-for-slot-values-in-an-intent-in-lex-v-2
The python AWS Lex v2 SDK method I used to add slot priorities to and Intent slot were:
create_intent
create_slot
update_intent

Related

AWS EventBridge scheduled events with custom details?

I'm trying to build an architecture where a single Lambda is triggered on a schedule with multiple parameter sets.
So for example if I have three sets of parameters and set schedule to ten minutes I expect to get three executions every ten minutes.
Is there a way to trigger an EventBridge scheduled events with custom properties so I can pass parameters to Lambda? I've noticed the details property in the event schema but couldn't find any reference to its usage with scheduled events.
To trigger a single lambda function for multiple parameter sets, you can create a separated schedule rule for each parameter set.
To provide input to your triggered lambda function you can set "configure input" when you select your lambda function as a target, for example you can provide your input in json format.

Zendesk: How to get count of tickets under each priority related to a specific view?

So in my rails app, I am trying to use an api to retrieve the count of all tickets related to specific view. But I want the count related to each priority. An example scenario: There are 25 tickets in View A. 19 of them are normal priority and 4 of them are high priority. I want to make an api request and get 19(for normal) in one of the request and 4(for high) in the other request. I trying to come up with an api url based on the documentation, but I am going nowhere. How do I do this?
There isn't a specific endpoint for the count of tickets in a view based on priority, but you can return all of the tickets in a view, and then sort them by priority on your own.
I recommend using the official Zendesk API gem for this. Once you've initialized the client, you could use this to return the counts for high and normal priority tickets in a view (replace VIEW_ID in the code below):
view = client.views.find(id: VIEW_ID)
urgent_count = view.tickets.select {|x| x.priority == "urgent"}.count
high_count = view.tickets.select {|x| x.priority == "high"}.count

Maintaining a Relative Order of Flex Tasks in a SQL DB

I have a task scheduling app that allows people to create 2 types of tasks...
•Strict- tasks with a set start time and duration
•Flex- tasks that have a duration, but no specific start time
Its also important to understand how flex tasks operate- Flex tasks will continuously reschedule themselves throughout your day in the nearest time you have open...so for example if the only task on your schedule today is a flex task like "Go workout - duration:60mins" and you open the app at 4pm it will have "Go workout" scheduled from 4-5pm for you , if you dont click the checkbox indicating you completed the task and open the app again at 5PM "Go workout will be rescheduled to 5-6pm so that the stuff you are meaning to get done is constantly in your face and trying to fit itself into the gaps of your life.
When a user views their schedule here are the steps I go through:
•Grab a array of all strict tasks
•Grab a array of all flex tasks
•Loop through each strict task and figure out how big of a time gap there is between the task currently being looped's end time and the next tasks start time.
•if a gap exists loop through the flex tasks and see if any of them will fit in the time gap in question. if a flex task is small enough to fit in the time gap add it to the strictTasksArray between the task being currently looped and the next task.
This works great as long as there is no need for any kind of ordering when it comes to flex tasks, but now we have added the ability for users to drag and drop flex tasks into a specific relative order aka if I have Task A,B,C,D
and I drag Task D & B to the front so that its now D,B,A,C it needs to save that ordering so that if you close and reopen the app the app will still remember to try to fit task D in , followed by B, A & C .....but im having big trouble thinking of a efficient way to do considering the ordering is relative and not strict...any ideas how to save relative ordering in a SQLIte DB without having to update every tasks's DB record every time a user drag/drops a task and changes the relative ordering?
If you have ever coded in Basic, you might remember numbering code lines. It was advisable to number in increments of 10 so that if later on you would have to insert a line or two you won't have to re-number all the code, just assign a new number in-between those of the previous and the next lines.
So, in your situation I would create a numeric field for Rank and for each new Flex task assign Rank = max(Rank) + 1024 (for example). Afterwards if the tasks are rearranged I would update just one "moved" task's Rank with the average Rank of it's new previous and next neighbours. That way any Rank change would be an update for one row only. Of cause if the Rank is int and I run out of integers in-between two tasks I would have to update them all, but that should be a rear occasion and I would just re-Rank them in new increments of 1024.
Sounds like you'd need some sort of either priority or order_number column to set the order in which the tasks come in. Just make it an int, and weight them accordingly. If you needed the DBMS to keep them in order using a query, you'd have to use sorting:
SELECT task_id, task_group_id, task_name, completed, priority
FROM tasks WHERE user = ? and task_group_id = ? and completed = 0 ORDER BY priority ASC
you can use some sort of foreign key to a task_group table to actually group certain tasks together if they're multipart, and then build a query to find all the ones that are either complete or incomplete. The weightage assigned would still be correct, because the tasks don't refer to each other by ID.

mql4: how to disable expert trading if it first run

I made an ExpertAdvisor, which opens an order if a price is getting higher or lower over a value of the past day.
Backtesting was fine, but problem is when I put this Expert on an MT4.Graph ( a live currency pair ), it opens an order immediately, because the current value of price, when I started the Expert, had greater or lower value than a max of past day.
I need a condition:
do not start trade if a price is greater or lower than any of extremums of the past day and it is the first Expert running on current currency pair.
You can just use a boolean variable that is initialized to FALSE. Then, before opening the order in the code, check for the value of that variable. The first time it will be FALSE, so your condition is not met and you don't open the order. Immediately set it to TRUE and adjust previous day min/max values accordingly.
On the next iteration it should then open your trade according to new scenario of previous date low/high.
Also, please do have a look to the IsExpertEnabled function here: http://docs.mql4.com/check/isexpertenabled
For further support on Server or Client side MT4 you can contact me via www.mt4software.com or Skype ID: mt4software

Quickbooks: Adding a negative value to an invoice using the QBDSK

Is there any way to add a line item containing a negative amount to an existing invoice?
I'm using QBSDK7 and QB Enterprise. (and if it matters .Net 3.5)
What we're attempting to do is automate the way we're creating invoices. We're already pulling in employee's time and applying it to the correct invoices, but when we go to add credits (just a negative amount on a line item on the invoice) using
InvoiceLineMod.Amount.SetValue(-1234)
it fails with the error "Transaction must be positive"
I've also tried adding a Service Item with a negative amount and giving it a positive quantity and I get the same result.
This seems like such a no-brainer as we have been doing this manually for the last 10 years. I'm guessing there is artificial restriction on this.
Some things to consider:
Credit Memos are no good as we need to display exact details of the reduction on the same page.
We don't have payments to apply yet in most cases.
This need to be done before any retainers are applied.
Any help would be greatly appreciated.
Can you show the complete code you're using to modify the invoice? Can you also show the exact error message you're getting?
It is possible, though to do you need to make sure that you're using a Discount Item as your ItemRef type (a Service Item will not work), and you need to make sure that the transaction as a whole is for a positive amount.
Sometimes our app has to adjust an invoice down with a negative number. I have been able to add negative line items using the following code. I have to set a quantity and a rate, instead of setting the amount.
IInvoiceLineAdd ila = ia.ORInvoiceLineAddList.Append().InvoiceLineAdd;
ila.ItemRef.ListID.SetValue(GetQBID(JobKey));
ila.Desc.SetValue("Adjustment");
ila.Quantity.SetValue(1);
ila.ORRatePriceLevel.Rate.SetValue(-1.00);
Quickbooks doesn't allow you to post an invoice with a negative balance. If you try to do it through the UI, it prompts you to create a credit memo instead. (And vice-versa if you try it with a credit memo.)
You can enter negative quantities and/or prices into the line items, but the total of the invoice has to be >= 0 or it won't post (i.e., add other line items that offset the negative amounts).
The solution is to use credit memos. Your client-side processing will be more complicated, but it's the only choice with Quickbooks.

Resources