Azure-logicApps-INSERTING ENTITY INTO A TABLE - azure

i have created a HTTP post request using logic apps and inserting that in a table. so i need the row key to be 1,2, and 3 so on. when i insert first entity it Should be 1 and for next entity it should 2 so on. i have tried Guid no solution. please if someone knows share the answer.

If you really need to avoid guids, you have to use other ways to implement auto-increment, you could create a queue or a table entity with your next ids to use.
In the logic app before do insert action, read the queue or entity, increment and save it then insert with the value you read.
The below is my test logic app, use a itemid table to store the auto-increment id and insert the id as rowkey to destination table test. Then replace the entity in the itemid table with the new id value.

Related

What is best way to delete all rows within an arraykey?

I have an entity Contact which has an array entity Specialties. Just a standard one to many relationship. One contact many specialties. (Specialties entity has few columns, might not be relevant). I have a screen to add list of Specialties to a contact on the PCF. I want to add a custom Remove All button on the Contact screen which will delete all values on the array against the specific contact. A contact can have large number of specialties (~10000)
What is best way to delete all the elements in the array?
Currently, I have the below function on the action property of the button and it is clocking and timing out.
for(spec in contact.Specialties)
{contact.removeFromSpecialties(spec) //OOTB remove from array method}
Any other better way to remove ~10000 records from the array entity?
From your question above, I assume that you will have a "Remove All" button in PCF screen with an action that deletes all the speciality records associated with that particular contact, but you will not delete partial records (like one or few records).
Also I assume the entity type of "Speciality" entity is "Editable" or "Retireable".
Keeping the above assumption in mind, you can create a new function and call that function from "Remove All" button action property.
Given below the code that will hard delete the entire records from database table just like you execute a delete query against a DB table,
function removeAllSpecialitiesForContact(contactFromPCF : Contact){
var specialityQuery = Query.make(entity.Speciality).compare(Speciality#Contact, Equals, contactFromPCF.ID)
var deleteBuilder = new com.guidewire.pl.system.database.query.DeleteBuilder.DeleteBuilder(specialityQuery)
deleteBuilder.execute()
}
This new approach might not get timeout after PCF action as you faced already.

How to insert data in azure easy table?

I want to insert the data in a specific column of azure easy table with xamarin forms.i already insert the data in a row but some fields are empty and these can be fill later by the user when user want to update the record.
for example there is a table which name isUSER(User-id,UserName,Email,Password,Mobile-No) user enter all data except MobileNo and it may or may be entered first time but may enter later.if they enter mobile number later then how I do that ?
First of all , All CRUD are operated on the object in Azure easy table .If you create this record at the first time, You could insert this record to Azure easy table. If user want to add the mobile number in the next time, you could query this record, then delete the old data, put the new record to the table.
You could refer to following link.
https://officialdoniald.azurewebsites.net/2017/02/24/xamarin-forms-azure-easy-table-accsess/
If you want to know more basic knowledge, you can refer to the link below
https://blog.xamarin.com/getting-started-azure-mobile-apps-easy-tables/

Cassandra - data modelling help needed

I try to design social network ( kind of ) application.
I have a User, he has Follower(s), and there is a Timeline.
My timeline table look like:
user_id
second_party_user_id
created
other_fields
So, when 'second_party_user' posts any new content, I get all people who follow him, and insert into their Timeline second_party_user's post.
When user comes to see timeline, I do a simple request to his timeline by user_id.
The problem is that I need to get ordered items. And if I want to get ordered by created, I need to put it as a second clustering column, not a third one.
At the same time, if I put it as a second clustering column, ie:
user_id
created
second_party_user_id
other_fields
then I would have a problem when one user unfollows second_party_user, ie how can I delete by (user_id, second_party_user_id).
Any help will be highly appreciated!
Thank you in advance.
To handle those features you can use two tables, one for get the timeline ordered and another one to handle the elimination in both tables.
//order timeline by created date
user_id(pk)
created(ck)
second_party_user_id
other_fields
//with this table you can get created to delete in the first one and
//delete this table with (user_id,second_party_user_id)
user_id(ck)
second_party_user_id (ck)
created
other_fields

Azure Table Storage - remove columns

I think this is not possible, but however I ask the question, maybe I have missed something.
Can we add/remove columns from an azure table?
For example by default we get those columns: PartitionKey, RowKey, Timestamp, ETag. Can I add for example another 3: FirstName, LastName, Email columns?
After that I will insert some values and I want to remove column Email and add instead column Address. Can we do this?
As Igor rightly said, Azure Tables do not have the concept of rows and columns. A table can contain zero or more entities and each entity can have a maximum of 255 attributes (an attribute is a name/value/type). Off of these 255 attributes, 3 of them are system attributes (PartitionKey, RowKey and Timestamp) which you can't update through your code. When creating an entity you define PartitionKey and RowKey and after that they become readonly properties. So when it comes to updating an entity, you can only update 252 attributes.
To manage data in an Azure Table, there's a REST API and you provide attributes of an entity in the request body. Azure Storage provides two ways by which you can update an entity - Update and Merge.
When you tell Azure Table Service to Update an entity, it simply drops all the existing attributes for that entity, and inserts the attributes defined in the request payload.
When you tell Azure Table Service to Merge an entity, it looks at the existing entity attributes and compares them with the attributes defined in the request payload. If it finds matching attributes, it simply updates those attributes. If the attributes are not present in existing entity but are defined in request payload, those attributes get added to the entity. If the attribute are present in existing entity but are not defined in request payload, they are not changed.
Now coming to your problem.
So let's say you already have an entity where you just defined PartitionKey and RowKey. Now you want to add FirstName, LastName, Email attributes. Because these attributes are not there in the entity, you can either use Merge or Replace to update the entity and these attributes will be added to the entity.
Now you want to drop Email attribute from an entity and instead add Address attribute to that entity. What you will do is perform an Update operation on that entity where your request body will have FirstName, LastName and Address attributes only (no Email attribute). When you update the entity with this request payload, Email attribute will be removed from the entity.
Azure Tables do not have "columns" as SQL tables do. Azure Tables have entities. Each entity has up to 255 properties. Most tools that let you look at an Azure table, choose to visualize the data in it tabular with columns. However, in reality, each entity (row) is a collection of properties.
Therefore, you can save objects/entities into an Azure Table with different properties, everytime you do a save. It makes things somewhat confusing, but you can do it.
HTH
I think programmatic answers given above is the best solution in terms of achieving the functionality.
But in case, you are working in the development mode and you have inserted an unnecessary attribute which you want to remove. you can do the same by using azure storage explorer.
You can export the table of choice, delete the property in the CSV file and import it back in new table. drop the existing table and rename the new table to the existing one. This is kind of a work around.

Updating a table Access and Excel VBA

I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed in an excel sheet that is connected with MS Access database. ID is the only unique field. Sometimes, my user submits a transaction that has let's say 5 records. Then, they want to modify the submitted data in case if they entered incorrect amount and they want to correct it. I want to write a code in VBA that will do the update. my current query is:
Update table Transaction(ProductName,Amount) set ProductName=#Product,Amount=#Amount)
where Date=#date;
This query does not work fine because obviously it replaces all the records data with the data of the last resubmitted record because my condition is weak. My difficulty is that I can't find a good condition in the where clause that will do the update a record by record accordingly.
Please help,
You will need to use the unique id of the record, in your case the ID field to guarantee you are updating the correct record.
Something like the following:
Update table Transaction(ProductName,Amount) set ProductName=#Product,Amount=#Amount) where ID = "id of record you want to update"
Enjoy!

Resources