Amazon Dynamo DB - Scan & Update table records - iOS SDK - iphone

Is there an option to scan & update a record in a DynamoDB table using a single API. Consider I have list of items in a Items table, with the fields (ItemID, ItemName, ItemAssigned). ItemID is the Hash key of the table. Items IDs are named like , Item1, Item2, Item3 etc., The users will not know what are the items are in the table. So, in the app, if a user taps "Get an item" button, then a random item will be fetched and assigned to him. Then ItemAssigned is set to YES. The Items tabe Then the item will not be assigned to any other user. This is what happens.
Steps:
1. Taps "Get an item"
2. Scan the first item from the Items table, where ItemAssigned = NO
3. Show the item in the home screen
4. Update the item in the Items table to set ItemAssigned = YES
This works good, if one user is trying to get the item at a time. The problem occurs when two users A & B are trying to get an item at the same time, and the same item is assigned to both the users.
So first A fetches the item. Before the Items table is updated to set ItemAssigned = YES, B also fetches the same item. Now both A & B's home screens show the same item. This is wrong.
The only way is to Scan & Update the Items table using a single API. Is there any possibility to do this in Amazon DynamoDB?
Thanks.

Unfortunately there is no API that scans and updates in a single operation. You may want to look into conditional PUT item as this will allow you to implement a checkout like feature such that you can set "ItemAssigned = YES" only if "ItemAssigned = NO".
Your application code will need to handle the exception gracefully when dealing with a scan result, but will allow for the workflow you're requesting of only allowing one user to see the item.
API docs for PUT item

Related

Flutter - How to show multiple pop up widgets one after another based on a list?

I am currently working on an iPad for a restaurant's order management. I am fetching the orders from an API and when there's a new order that order has a bool property isNew which is set to true. I am storing the new orders in a list called pendingOrders. I have created a customEndDrawer that only shows when there's a new order and it lets the user accept or reject the order. But it only works for single order. But I want to implement a system that will keep triggering the customEndDrawer until the pendingOrders list is empty. For example: If there are 2 orders in the pending ordersList the customEndDrawer will show up and let the user accept and reject the order. After users action it will again trigger with the new order details and let user accept or reject that order.
What would be the best solution for implementing this system?
Have you tried a for while loop, whilst your pendingOrders list has items that meet the condition isNew == true? Maybe you can link it to the API stream, so you on each event you trigger the function until each order in your list no longer meets the previously stated condition?

What is the correct way to save a list of items in a web form?

There is some form in a web form. It contains the list of items that use can edit, remove and change.
When the server receive the list of items, it should update existing items, create ones and remove the deleted ones.
I only know the naive and quite ugly approach:
When server receives the list of items from a client, it gets the actual list of items from the database
Pass round the received list of items:
2.1. If element has the ID and database has the element with this ID, this element updates
2.2. If this element doesn't have ID or database doesn't contain element with this ID, this element creates
Delete all items, that were not in the received list (marked as deleted)
The updated list of items are returnded to the client (with new IDs), and client displays them
I feel, that there is more elegant solution, and, propably, established for this task.
I had the same challenge and i solved it like this:
1-First when you load the page, create a list made up of id and data.
2-then the user fill the data.
3-those items that user doesnt fill should be deffault value.
4- then retrive the list from database and delete it and put the updated list
Hope this helps

Oracle BI: how can i retrieve another result list from current result list

I am using Oracle Business Intellgience (12c) and let's say I have a report resulted from an execution of the following query
select code_filial, max(paid) as maximum_pay
from leads_history
group by code_filial
It will return a table with highest budget value related to the each filial. Now what i want is the following: when i click to max(paid) result in a table, another table should appear with the information about max(paid) account. I tried master-detail relationship, but couldn't succeed.
Can anyoune help with that?
That's out-of-the-box functionality. As soon as you make a navigation action link to another analysis where your code_filial is set to "is prompted" the context will be passed and the analysis filtered.

iTextSharp table on every page

I need to make a PDF document with a table containing multiple rows and columns that shows client information.
I also need to show the products of this client. I create a loop which creates a new table with multiple rows and columns and the product information.
This works fine. I start with the client table and next I have multiple product tables. I've set KeepTogether to True and SpacingAfter = 20f. So after each product table I have some white space.
When the client has many products the product tables continue on the next page. Exactly what I want.
But on the new page I want to start with the client table again. What is the best workflow to do this?

Filemaker - Can I use a portal like a drop-down value list?

I am trying to work around a limitation that Filemaker 12 seems to have. In a value list that links to an ODBC attached SQL Server database, it doesn't display every piece of data. If there are 2 people with the same last name for example, it only displays the first person with that last name in the list. This is verified by the following in the Filemaker documentation (which I found after a lot of digging)
If the value list is defined to display information from two fields, items will not be duplicated for the field on which the value list is sorted. For example, if the value list displays information from the Company field and the Name field, and if the values are sorted by the Company field, only one person from each company will appear in the value list.
Portals on the other hand will find all the related data, I just don't understand how do something with the data once I get it in the portal. I essentially thus wish to use a portal AS my drop-down value list, and then to use it as I would have a value list (which is then to act as the key to do the rest of the lookups on the page to fill out the invoice.
The major issue here (other than this maddening choice Filemaker seems to make) is that the external file I am pulling the data from is an ODBC mounted SQL Server file, so I can't do something easy like a calculated field which would give me last name & " " & first which would make almost every person unique. Filemaker won't let me do that because it says I can't do that with a field that is not indexed. Any help would be greatly appreciated!
Assuming that we're starting with table MyTable and we're trying to get a ID from the People table for the selected person, which we'll call ID so that we can put it into MyTable::PersonID
Start by creating a new Table Occurrence of your People table and call it PeopleWhoCanBeSelected. If you want every person in the People table you can connect it to MyTable with the X relationship. If you want to show just a subset of the people you can build a different relationship.
Now, on a layout displaying records from MyTable you will make a portal showing records from the PeopleWhoCanBeSelected table.
In the portal put a button. When that button is pressed use the Set Field script step:
Set Field MyTable::PersonID to:
PeopleWhoCanBeSelected::ID
That should do it. You can make the button an invisible overlay on the entire portal record if you like, so that the user clicks on "the name" instead of "the button next to the name".
Now, if you want to pull additional data through to the MyTable record, you'll need to create a second Table Occurrence, called People with the relationship MyTable::PersonID = People::ID. Then you can get information on the specifically chosen person through that relationship.