How to update Contentful reference efficiently - contentful

I have a Content Model X with 200+ entries.
One of the fields inside my Content Model X is a reference field referencing the Content Model A.
However, I realized that this Content Model A is no longer suitable for my use case so I created another Content Model B.
I wonder if there is an efficient way to update all the reference field for each entry from Content Model A to Content Model B ?
Or do I have to update the reference field manually for 200+ times ?
Thank you!

Before actually modifying 200+ content objects, another important question to be answered is that at what stage you will change your model. For instance, you cannot change the model if you have any entry (you have 200+). Therefore, it is important to follow versioning of the Content Model, for instance, v1 with reference to Model-A and v2 with reference to Model-B. Once you have finalized the structure of v2, use Content Management API to switch entries, hence change from Model-A to Model-B
(https://www.contentful.com/developers/docs/references/content-management-api/)
Of course we should try freeze the model structure, but these changes still happen and is a very common scenario. Therefore, changing manually is definitely not an option.
Also, these Content Management APIs are suggested solution from Contentful, therefore scalable solution.

Related

Azure Search - Cost study of MergeOrUpload operation?

I've written two different functions to populate the same document but different attributes. One of the function updates A1,A2,A3 attributes of document X and other function updates A4,A5 attributes of same document X given the document id. They are using MergeOrUpload operation to update the document.
I'm trying to evaluate the cost of MergeOrUpload operation. How it works at the backend and does it read the entire document and then merge the new attribute values and push back the document to the index or what? How much cost-effective it is?
It would be more efficient to include all attributes in a single call, rather than first creating the document with A1, A2 and A3, and then sending a mergeOrUpdate call to add A4, A5 and A6. In the backend, all index files are "read-only" to facilitate the distributed and concurrent nature of the service, so when you update a document, we actually need to do a copy of the original document which includes the newly updated attributes.
Your best bet to get accurate cost would be to do your own testing using your own data and usage pattern, however, its likely that you will discover creating the document with all the attributes is the most efficient approach.

SharePoint choice or lookup field representing other list's fields

The scenario is that I have a Projects list and there are a bunch of different SPFieldUser fields associated to it. I have another list representing the Project's Logbook (it contains a bunch of data about different milestones of the project). The relationship is like this: (1 project list item : 1 logbook list).
I have to store some metadata in a logbook's list item that points to a specific user, stored in Project's list item. For that I have to create a choice field which represents different SPFieldUser fields from the project's list.
The question is which is optimal way of representing such a structure?
I can just hard-code a choice option for every SPFieldUser in a Projects list, but then when I have to reference this data in a code, I'll have to somehow transform the choice's value into internal name of the associated project's field.
I can also create a lookup of those fields and this way, accessing it is easy. I can show the Title to user and have the internal name stored in a lookup.
I was also thinking about defining some kind of custom FieldType, but I feel like it would require far more work than an of the other methods.
So which method do I choose? Can someone probably suggest a better way?
Lets check out your options one by one in terms of efforts and scalability.
1 Hardconding option : High efforts [Not at all recommended]
- Column needs to be updated when new user joins or user leaves the
company.
- Once format of data is specified its difficult to change. [e.g. FirstName+Lastname or Empid]
Highly recommended OOTB option : very low efforts
Configurable [Please check if you can change format of user data once added as lookup column.]
Custom column type will take coding efforts.
My recommendation is 2nd OOTB option. If you find some flaws in 2nd option let us know we can look for soultion.

bind textbox with core framework

i already searched for an answer but without finding one to my specific problem.
i am using core data to save profiles and display them in a table. since core data is already set up, i wanted to use it also for storing application settings.
i've set up the model, set up an array controller to retrive the data, but now, i have no clue on how to connect this array controller to a single textbox.
i try to explain: theoretically my model could have more entries, just like the profile model has. but it has just one with some settings, as if a database would have only a single data row. is there a way i can specify that i want the data contained in the very first row? dont know if my question is clear, its not so easy to explain. please if it was not clear let me knwo and i will try to explain it again.
thanks
igor
Don't put application settings in Core Data. Any time you find yourself thinking that you want just one instance (row) for an entity, you're doing it wrong.
Cocoa Touch provides a class called NSUserDefaults specifically for the purpose of saving app settings. Look into that, it's almost certainly what you want.

Multiple Results Sets in EF 5

So I am following the instructions found here: http://msdn.microsoft.com/en-US/data/jj691402 concerning how to handle multiple result sets from in EF.
I am trying to avoid the second solution as this will involve changing the EDMX by hand, which concerns me as I do not want to have to worry about other members on my team overwriting them.
But the first example still seems to be lacking. It refers to the ObjectContext.Translate<TEntity> method, but no where does it say how the <TEntity> is being created. Any time I create an Entity by hand, I of course get Error 2062, "no mapping between entity set and association set". Is there a step that I am missing? Or does the first solution not work with a DB first approach?
If you have create entity by hand in EF designer without mapping it to existing table or database view you indeed receive an error. Try to create complex type instead.

How do I add a set of strings to an Entity?

This is a simple requirement: I want to add a set of strings to Accounts in Dynamics 2011. The string are external IDs for other systems. All the strings should be unique accross all entities.
The only way I can see to do this is define the strings as entities (say 'ExternalCode') and set up a 1:N reslationship between Account and ExternalCode, but this seems incredibly overweight. Also, defining as an entity insists thhat I give the 'ExternalCode' a name, which it obviously doesn't have.
What's the best way to implement this?
Thank you
Ryan
It may seem overweight, but think about entities as if it were tables. Would you create a second table inside MS SQL? If so, then you should create another entity. CRM is very well optimized so I wouldn't worry about this additional overhead.
Alternatively, you could always carry the GUID in the other system.
How are these unique references entering your CRM system. Are you importing the data from each of the external systems? If so I assume the references are unique in the external system? Once imported you want to make sure that any of these references are not duplicated?
Additionally, how many strings are we talking about here? If it is a small number then it would make sense to just define attributes to manage them and check for duplicates in one of the following ways:-
1) Some javascript could be used to make an oData query to confirm the 'uniqueness' of your external reference number before the record is commited. (But, this is not sufficient is records will be created programmatically in the system also).
2) A plug-in which fires on pre-create to again query the system for other records which match the same unique reference numbers and handles the event of a match accordingly.
However, if there are many of them then it may make more sense to define a separate entity as you say and then as above you could associate a new 'reference record' with the entity via a plug-in, but again, check if the record already exists and then either handle an exception or merely associate with an existing record if that is appropriate.
I think they key is what you want to do if you do find a duplicate and how these records are going to be created in the system (e.g. via UI or programmatically or potentially both).
Happy to provide some more assistance if you have some more details.

Resources