So Azure Table Storage has three default member properties for its TableServiceEntity class, one of which is Timestamp. After release to Production, we now realize we need a CreatedDateTime property instead of Timestamp b/c we have no control over the Timestamp value, which acts more like a "Last Modified" value rather than "Created Date" value.
How can I copy the value in Timestamp currently over to my new property? In SQL, this seems pretty straightforward, but the cloud is a different animal. Thanks.
In Table Storage you have no schema. In a single "table" you can have 10 rows with a C# defined class of Person and 10 rows of class Dog with COMPLETELY different properties.
The reason I am saying this is because there is no schema, so the easiest thing to do would be to "re-insert" the rows as a batch with the new column/property added to the class. You can also do an UPSERT as well:
http://blogs.msdn.com/b/windowsazurestorage/archive/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection.aspx
If the column is already defined then its easy and u would just do an update, but it sounds like that new column does not exist on the previous rows entered.
If you are using a class, just add the new field for the create date time. Pull all the data down and copy the timestamp to the new field and then call update on the row. If you are already doing inserts and deletes and thigns, should be pretty straightforward.
Related
I have a SharePoint list that contains a choice column with the 'multiple selection' option turned on. Each item in this list contains data related to preferences for a given user, and the choice column will store the IDs for each of the user's 'favorited' reports.
I would like to write a Patch formula in Power Apps that writes a new value to this column, but retains the existing values. Here is an extract from my current formula, triggered when a user selects the 'Add To Favorites' button, where 'Favorites' is the choice column that already contains values:
Patch(
'Platform User Preferences',
LookUp(
'Platform User Preferences',
UserEmail = User().Email
),
{Favorites: [ThisItem.ID]}
)
Current state, this formula overwrites the existing values in the choice column with the new single value, instead of adding it alongside the existing values.
One approach I have attempted (based on reading similar use cases online) is to create a collection from the Favorites column, add the new value to that collection, then patch the entire collection back to SP. However, I have had similar problems doing this as I do not fully understand the model of a collection that is based on a multi-value choice column. For example, the following also appears to completely wipe the data in the collection, rather than add to it:
ClearCollect(favslist,Filter('Platform User Preferences',UserEmail = User().Email).Favorites);
Collect(favslist, {Value: ThisItem.ID});
Any help with solving this problem would be most appreciated!
You'll need to create another collection that contains each selection of the existing favorites. Right now your 'favlist' collection contains one item that contains all the existing favorite selections, then youre adding you new item. This isn't formatted correctly this way.
Try updating your existing code before you patch, by using a ForAll and collect the existing items:
ClearCollect(existingfavslist,Filter('Platform User Preferences',UserEmail = User().Email).Favorites);
ForAll(existingfavlist, Collect(favslist, ThisRecord.Value));
Collect(favslist, {Value: ThisItem.ID});
Then just patch your collection 'favslist' to the list
I have Spotfire dashboards that use Custom Expressions in their visualisations. The name of a database variable was changed at source in SQL Server, so I replaced the column in my information link with the new column name and reloaded my data.
I was given an option to match 'old column name' to 'new column name', which I did.
My problem is that any Custom Expressions that used this 'old column name' have not updated to the 'new column name' in this process, and consequently there are many errors. This column is used in custom expressions for dozens of KPIs and charts, to manually go through them all will be time consuming.
Does anyone know of a way to update a column name so that it will update every custom expression in a dashboard?
I don't think there is a way to programmatically update all of the expressions. It's frustrating that match columns don't actually update thru all functions in the application. However, you might try adding in a change column names transformation to change the column name back to the old name, and then your calculations would update.
I am using the Logic App designer on Azure. Added "SQL Azure - Insert Row" as an Action, it prompts me to insert values for the columns but all the columns are marked as required and it doesn't save the changes/sequence if a value is not entered there.
Is there anyway of bypassing this or making the columns optional?
I tried this previously, there was no way to make the columns optional but i figured a workaround.
First, in the designer put any value, then open Code view and look for the columns you don't need and just delete it from the JSON schema and hit save :)
that should do it for you, but next time you open in designer and try to edit you have to do this again.
let me know if it helps
Edited
I added a screenshot of the steps that i made while trying to replicate this. (note that your database schema should handle these null values for the columns, in my case the Guid had a default value of newid() and the other column allowed nulls). You always pass null to the columns, not passing values at all might make sense for columns that has values computed or has default values (like newid() uniqueidentifier or getdate() for created/modified time)
I am getting the error : "Relational operators are not supported in text fields" when I am doing db.FTSearch(FIELD examplefield >= 02/25/2013). Here field name is "examplefield" & field type is datetime
Can any one help for fixing this issue?
As described in the question that Simon linked to, the UNK table in a database will determine the data type that is used for a field when doing full text searches. The data type you have set for that field on any particular form does not matter - the field in the UNK table is defined by actual data on documents, and does not automatically re-calculate itself. So, you first want to ensure that "examplefield" in every document in which it exists has a datatype for date-time. But then, you would also need to re-build the UNK table. There are 2 ways - that I know of - to do this:
Drop the full-text index on the database, compact the database, and then re-create the index.
Create a new replica of the database and replace the existing database with the replica.
Also, you can check the datatype for a field in the UNK table using the freeware NotesPeek tool - which you can download from here:
http://www-01.ibm.com/support/docview.wss?uid=swg24005686
In general, I wouldn't use FTSearch. I would create a hidden view with the first column sorted by examplefield as text with format yyyy-mm-dd. Then, you can use this:
set o_doc = o_hidden_view.GetDocumentByKey("2013-03-25")
while not o_doc is nothing
'Do something
set o_doc = o_view.GetnextDocument(o_doc)
Wend
In my opinion, it has a better time response at expense of put the load in the server. As always, it depends what type data you want to handle.
I want to know that How to Insert New Columns to an existing database Table using Subsonic 3.0.0.5 MIGRATIONS.
Basically I want to alter an existing table in MS SqlServer database and add three more columns into it.
Please tell me How I will be able to do it
Regards,
Naveed Khan
Just change your object and the column will be added/updated whatever. So if you have an object called "Post" and add a property, it will be added as a column in the DB.
See this video...
http://subsonicproject.com/docs/Simple_Repo_5_Minute_Demo
It has to do with the conventions of SubSonic.
As the object is singular, it adds the plural to the table (or expects the table to be plural).
So it will expect an object called Order to map to a table called Orders.
There is only two solutions that I can see for you
1) Rename you table to the plural name.
2) Modify Subsonic code to remove the adding of the plural.