Can l use PowerShell to update the property of entity in azure storage to null - azure

I have retrieved an entity from my table. I want to set one of the property to null. Can I do that?

Simple answer is No. You can't set a property's value to null.
Essentially Azure Table is a key/value pair storage. An entity contains attributes and each attribute must have a name, type and value and the value can't be null.
One thing you could do is remove that particular attribute from the entity. The approach for that would be:
Fetch the entity.
Remove the attribute from the entity for which you want to set the value to null.
Update the entity.

Related

Association without ReferenceVersionField

Is it possible to have a OneToManyAssociationField as entity extension on for example ProductManufacturer without the ReferenceVersionField in my related custom entity?
If this is not possible, is it possible for the reference version field to have a custom name (so not product_manufacturer_version_id) On first sight, this also does not seem possible.
About the error
I am currently getting the following error when trying to search for manufacturers using $criteria->addAssociation('myCustomEntity'):
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_manufacturer.myCustomEntity.product_manufacturer_version_id' in 'field list'
About the big picture
The use case is similar to the SeoUrl entity where there is a ‘foreign_key’ field which can have a relation to multiple entity types. My entity has not associations, but the other entities are extended to have an association to my entity. Just like the SeoUrl.
However, the DAL creates a query which uses the ‘product_manufacturer_version_id’ field, which does not exist on my custom entity…
Is it possible to have a OneToManyAssociationField as entity extension on for example ProductManufacturer without the ReferenceVersionField in my related custom entity?
No, you must set a ReferenceVersionField when adding associations to the definition of a versionized entity. This is too deeply rooted in the basic principles of the data abstraction layer to work around.
If this is not possible, is it possible for the reference version field to have a custom name (so not product_manufacturer_version_id) On first sight, this also does not seem possible.
You can change the storage name of the field. That is the name of the corresponding column within your database table. When you instantiate ReferenceVersionField you can use the second, optional argument to provide the storage name:
public function __construct(string $definition, ?string $storageName = null)
The storage name should be provided in snake case. The name of the object property for the field will then be derived from the storage name and converted to camel case. So given you provide my_version_custom_id for the storage name, the object property of the entity will be myVersionCustomId.
Your entity may have multiple associations to different entities, but if those entities are versionized your foreign key constraint has to be a combination of columns for both the foreign primary key as well as the foreign version id.

Question about the [PXDimension] attribute

If I set up my own segmented key ID to be used with a custom DAC's identity field, Do I need anything else other than the [PXDimension] attribute on that DAC field to implement the enforcement of that segment setup?
You would have to define your custom field with the [PXDimensionSelector] attribute.
When this attribute is used, the first parameter should be the dimension name (defined in the Segmented Keys page - CS202000), followed by the ID value (this is the value persisted in the DB), and then the CD value (this is the user-friendly value).
For instance, the Item Class Dimension selector can be defined like this:
[PXDimensionSelector(INItemClass.Dimension,
typeof(Search<INItemClass.itemClassID, Where<INItemClass.stkItem, Equal<False>>>), typeof(INItemClass.itemClassCD), DescriptionField = typeof(INItemClass.descr))]
When the value is then added to the UI, the framework will recognize the Dimension-selector attribute and it will create it as a PXSegmentMask field instead of a regular PXSelector

Can I create azure cosmos db document with a custom key other than Id

I am using azure cosmos db for saving and editing my session information. Currently i am not using ID in my document, instead i have another unique field with all docs. How can i update my query to get documents?
You can use whatever property you want, for your custom key (just make sure you don't remove its index). By default, all properties are indexed unless you explicitly set up a custom index policy that removes certain properties from being indexed.
You cannot eliminate the built-in id property though; if you don't set it explicitly, it will just be set to a guid.
If you are doing queries, this really shouldn't matter, functionality-wise. Just search on whatever properties you want. However: If you are doing point-reads (a read is more efficient, RU-wise, than a query, when retrieving a single document) you can only perform a point-read by specifying the id property, not your custom property. If you must use a custom property and you need to do point-reads, you can consider storing your custom property as id as well (as long as it's guaranteed to be unique per document).

Dynamics CRM is ignoring the default value for two-option field

Quick question.
I have a custom two-option field on an entity, with "Yes"/"No" as the values; "Yes" has the underlying value 1, while "No" has the underlying value 0. I've set the default value for this field to "Yes". However, when I create new entity records, the field always gets the value "No" (0 in the database). It seems to be ignoring the default value I've set. Why?
The field is not present on any of the entity forms, as it's only used in underlying plugin code. Should that matter?
Are you creating a new record for this entity using code that uses the strongly-typed objects? If so, when you create a "new" entity in code, I'm guessing the class itself is setting that field to "false" by default. I don't think those generated classes respect the default values in the metadata. I also think that all fields are submitted on a create when you use these generated classes. That means that your class is setting it to "no" by default and then on create, the system thinks that you explicitly set it to "no" so default values are not applied. I think you need to explicitly remove that attribute from the attribute collection of your entity before you create it. That way the system should respect the default value on create. Sorry for all the "I thinks" but I'm not in a place that I can test or verify all of this. :)

how to use JSF Converter when the property is not uniquely identifiable

In my JSF page, I have a <rich:autocomplete/> which must be filled by selecting an object from the list. The id of the object does not have useful meaning, so I have to write a Converter to change it to readable string.
Unfortunately the string representation of the object could not uniquely identify different objects and so the conversion is not reversible. Now I want to know how I could solve this problem? Is it possible to store the id of the selected object into a <h:inputHidden> and pass it to the view scoped backing bean?
You're using the input component and the converter the wrong way. You are apparently using the object's string representation (the item label) as input value, while you should be using the object's unique identifier (the item value) as input value. The converter is merely to convert between the custom object and the unique identifier, not between the custom object and the string representation.
I have searched this and until the moment there are no direct solution provided by the rich:component as it does not has itemValue like rich:select
Also there are 2 workaround solution.
to use JavaScript to add the id value of the selected item to a
hidden field and then use this hidden field to identify the
selected item
I used the fetchValue attribute to concat item_id - item_name
then I created a converter which substring the item_id to identify
the selected item.

Resources