MDX Attribute Value Key - ssas

I've faced such a problem:
I have a dimension [Project_sales] with one hierarchy [Default] in my cube [Sales_planning_RP].
I've created a custom property for this dimension and named it "Object".
When I created it I was asked for:
1)Property Key
2)Property value
Now I Have Source-table for this dimension with 2 additional fields:
1) [Object_code] ex:('O01') <-This is what I need (see question below)
2) [Object_name] ex: ('Object # 3213, editable') <-This is What I get
But I see only one property in OLAP:
[Project_sales].[Default].CurrentMember.Properties("Object")
Which gives me just Object_name.
So my question is how can I get the key of my property "Object" with MDX?
My dimension properties:
http://i.stack.imgur.com/N2Aej.png
My dimension has the following "parent_child" hierarchy:
Project->Object->Element_of_area
Every element of this hierarchy has as attribute "Object", which can be called in such a way:
[Project_sales].[Default].CurrentMember.Properties("Object")
In the properties window (in my picture) of the attribute "Object" there are 2 properties:
1)keyColumns
2)NameColumns
I repeat: "Object" here is not a member of dimension, it's an attribute!
And it has its own key and name.
I can get its name, but can't understand how to get its key, which is also loaded into cube.
Look at my member_properties list:
image_2
And here is a part of XMLA-code of my dimension to makes things clear:
<Attribute>
<Annotations>
<Annotation>
<Name>TypeOfInformation</Name>
<Value>1</Value>
</Annotation>
<Annotation>
<Name>TypeOfNameInformation</Name>
<Value>1</Value>
</Annotation>
<Annotation>
<Name>P4SSAMOVersion</Name>
<Value>2</Value>
</Annotation>
</Annotations>
<ID>Object</ID>
<Name>Object</Name>
<KeyColumns>
<KeyColumn>
<DataType>WChar</DataType>
<DataSize>40</DataSize>
<Source xsi:type="ColumnBinding">
<TableID>_x0036_Project_sales</TableID>
<ColumnID>Object_code</ColumnID>
</Source>
</KeyColumn>
</KeyColumns>
<NameColumn>
<DataType>WChar</DataType>
<DataSize>255</DataSize>
<Source xsi:type="ColumnBinding">
<TableID>_x0036_Project_sales</TableID>
<ColumnID>Object_name</ColumnID>
</Source>
</NameColumn>
<OrderBy>Key</OrderBy>
<MembersWithData>NonLeafDataHidden</MembersWithData>
<AttributeHierarchyVisible>false</AttributeHierarchyVisible>
</Attribute>

Ok, now it's clear!
There are 3 properties of an Attribute that may contain data:
1)Key
2)Name
3)Value
If Name is not empty and Key is not empty, you get Name when call .Properties() function.
If Name is empty and Key is not empty, you get Key.
Here is the source: https://www.mssqltips.com/sqlservertip/3271/sql-server-analysis-server-ssas-keycolumn-vs-namecolumn-vs-valuecolumn/

Related

Document id reference desn't work for impex

I have a problem with impex which contains document id reference.
From docs:
"Especially for importing partOf item values it is necessary to reference these items by means other than the usual unique column technique because partOf items often do not provide a unique key but only hold their enclosing parent as foreign key."
Items from *items.xml (only the most important parts)
<itemtype code="A" autocreate="true" generate="true" abstract="true"/>
<itemtype code="B" autocreate="true" generate="true" extends="A">
<deployment table="btable" typecode="20115" />
<attributes>
<attribute qualifier="code" type="java.lang.Integer" autocreate="true" generate="true">
<persistence type="property"/>
<modifiers optional="false"/>
</attribute>
</attributes>
</itemtype>
<itemtype code="C" autocreate="true" generate="true">
<deployment table="ctable" typecode="20117" />
<attributes>
<attribute qualifier="code" type="java.lang.String" autocreate="true" generate="true">
<persistence type="property"/>
<modifiers optional="false" unique="true"/>
</attribute>
<attribute qualifier="test" type="A" autocreate="true" generate="true">
<persistence type="property"/>
<modifiers optional="false" partof="true"/>
</attribute>
</attributes>
</itemtype>
Impex code:
INSERT B;code;&docIdRef
;1;docId
INSERT_UPDATE C;code[unique=true];test(&docIdRef)
;uniqueCode;docId
Error message:
cannot create C with values ItemAttributeMap[ registry: null, type: <null>, (...) due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator#3b777877]:missing values for [test] in model C
When I removed 'partof' modifier from 'test' attribute (C class) everything worked fine.
I wonder how impex should looks like if i want to keep 'partof' modifier.
When you use partOf you must reference the partOf using the owner.
So it does :
INSERT B;owner(C.code);&docIdRef
;uniqueCode;docId
INSERT_UPDATE C;code[unique=true];test(&docIdRef)
;uniqueCode;docId
You don't need to assign B an identifier, you just need to reference the owner.
If you know for sure that your data is correct you can use [forceWrite=true] modifier or legacy mode to skip service layer validation.
You should also make sure that this configuration is what you really need. Setting either optional to true or partOf to false or providing default value should fix the issue as well.
Since you have mentioned partof="true" you can not assign a reference of type A. You can only create a new entity.
Check the OOTB AbstractOrder2AbstractOrderEntry relationship, they have mentioned partof="true" for AbstractOrderEntry means you can't reference any other AbstractOrderEntry to Order. You can always create new entry.
Have a look at HMC site as well
You can see here there is no + Add Entry button available here. The reciprocal can be possible.

latitude/longitude info in a GML Bounding box

If, for example, we have bounding box as given below in gml:
<gml:Envelope>
<gml:lowerCorner>42.943 -71.032</gml:lowerCorner>
<gml:upperCorner>43.039 -69.856</gml:upperCorner>
</gml:Envelope>
Now, for the lower corner, which value is the latitude and which is the longitude. Could not find this info in online documentation.
Thanks
Wanderer
The above GML is formatted in GeoRSS
From the GML schema:
<complexType name="EnvelopeType">
<choice>
<sequence>
<element name="lowerCorner" type="gml:DirectPositionType"/>
<element name="upperCorner" type="gml:DirectPositionType"/>
</sequence>
<element ref="gml:pos" minOccurs="2" maxOccurs="2">
<annotation>
<appinfo>deprecated</appinfo>
</annotation>
</element>
<element ref="gml:coordinates"/>
</choice>
<attributeGroup ref="gml:SRSReferenceGroup"/>
</complexType>
<element name="Envelope" type="gml:EnvelopeType" substitutionGroup="gml:AbstractObject">
<annotation>
<documentation>
Envelope defines an extent using a pair of positions defining opposite corners in arbitrary dimensions. The first direct position is the "lower corner" (a coordinate position consisting of all the minimal ordinates for each dimension for all points within the envelope), the second one the "upper corner" (a coordinate position consisting of all the maximal ordinates for each dimension for all points within the envelope). The use of the properties "coordinates" and "pos" has been deprecated. The explicitly named properties "lowerCorner" and "upperCorner" shall be used instead.
</documentation>
</annotation>
</element>
which leads to SRSReference group which contains the code to allow you to look up the axis order and units (amongst other things) about your coordinates.:
<attributeGroup name="SRSReferenceGroup">
<annotation>
<documentation>
The attribute group SRSReferenceGroup is an optional reference to the CRS used by this geometry, with optional additional information to simplify the processing of the coordinates when a more complete definition of the CRS is not needed. In general the attribute srsName points to a CRS instance of gml:AbstractCoordinateReferenceSystem. For well-known references it is not required that the CRS description exists at the location the URI points to. If no srsName attribute is given, the CRS shall be specified as part of the larger context this geometry element is part of.
</documentation>
</annotation>
<attribute name="srsName" type="anyURI"/>
<attribute name="srsDimension" type="positiveInteger"/>
<attributeGroup ref="gml:SRSInformationGroup"/>
</attributeGroup>
So without a specified SRS it is impossible to answer your question, we don't even know what units your coordinates are in.

Are line item properties exposed in the Shopify Order API?

Is it possible to retrieve the custom properties (see here http://wiki.shopify.com/Line_Item_Properties) for all the order's line items within the Order API?
I need to create a custom report for all orders, but they rely on displaying these properties.
Line item properties are exposed by default through the Order API where they exist. Here's an example line-items XML snippet, notice the 'Monogram' property at the bottom:
<line-items type="array">
<line-item>
<id type="integer">223039148</id>
<requires-shipping type="boolean">true</requires-shipping>
<fulfillment-service>manual</fulfillment-service>
<grams type="integer">0</grams>
<price type="decimal">9.99</price>
<quantity type="integer">1</quantity>
<sku/>
<title>All the Tests</title>
<product-id type="integer">90620559</product-id>
<variant-id type="integer">212221205</variant-id>
<vendor>soundcloud</vendor>
<variant-title nil="true"/>
<fulfillment-status nil="true"/>
<name>All the Tests</name>
<variant-inventory-management/>
<properties type="array">
<property>
<name>Monogram</name>
<value>omg</value>
</property>
</properties>
</line-item>
</line-items>
Note that the properties array will be absent if it's empty, so make sure you cater for that in your code.

SharePoint 2010: RemoveFieldRef and Inherits="TRUE"

I have created a custom content type that inherits from the OOTB SharePoint Picture content type. The only customisations I have made is to add a simple URL field, and remove two of the fields on the base type. See below:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Picture (0x010102) -->
<ContentType ID="0x0101020027f16ab27e6e45a6848c25c47aaa7053"
Name="Custom Picture"
Description=""
Group="Custom"
Inherits="TRUE"
Version="0">
<FieldRefs>
<RemoveFieldRef ID="{b66e9b50-a28e-469b-b1a0-af0e45486874}" Name="Keywords" />
<RemoveFieldRef ID="{a5d2f824-bc53-422e-87fd-765939d863a5}" Name="ImageCreateDate" />
<FieldRef ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Name="URL" DisplayName="URL" Required="FALSE" />
</FieldRefs>
</ContentType>
</Elements>
If I create a picture library based on my custom content type, the "URL" field that I added appears in the new/edit forms, however the two fields that I have attempted to remove are also displayed, i.e. the RemoveFieldRef's are being ignored. If I look at the content type in "Site Settings -> Content Type Gallery", these two fields are still listed there.
Setting Inherits="FALSE" on my custom content type (see MSDN definition) successfully removes just these two fields from the "Site Settings -> Content Type Gallery" page, however then none of the base fields are displayed in the new/edit forms -- only my custom "URL" field.
What can I do to ensure that all the fields from the base "Picture" content type are displayed on the new/edit forms of my picture library except the two fields that I have specifically removed?
I believe the nature of this issue to be the understanding of how content type inheritance works.
From MSDN (http://msdn.microsoft.com/en-us/library/aa544268.aspx)
If Inherits is TRUE, the child content type inherits all fields that are in the parent, >including fields that users have added.
If Inherits is FALSE or absent and the parent content type is a built-in type, the child >content type inherits only the fields that were in the parent content type when >SharePoint Foundation was installed. The child content type does not have any fields that >users have added to the parent content type.
If Inherits is FALSE or absent and the parent content type was provisioned by a sandboxed >solution, the child does not inherit any fields from the parent.
I think the key phrase above is "If Inherits is TRUE, the child content type inherits ALL fields that are in the parent including fields that users have added."
This means that in order to accomplish what you set out to do you will have inherits set to false and you will have to include FieldRef elements for all fields you wish to use in your content type.
You make no reference / don't include code for how the content type was added to your list instance. Make sure this has been updated to support the removal or setting of inherits to false.
These sites support what is described here.
http://kvdlinden.blogspot.com/2011/06/issues-with-removefieldref-and.html
http://nelsonlamprecht.wordpress.com/2010/08/25/sharepoint-2010-removefieldref-and-inherits%E2%80%9Dtrue%E2%80%9D/

SSAS - Is it possible to add an attribute to an existing dimension w/o redeploying the entire cube

I have a dimension Entity with just Key and Value attributes. We need to add a new attribute, IsSpecial with a default member of [False].
When I try to run the xmla, I get the following error:
Errors in the metadata manager. The
cube with the ID of 'X', Name
of 'Y' was invalidated by
operations in the transaction.
Here's a fragment of the XMLA used to alter the dimension
<Dimension>
<ID>Dim Entity</ID>
<Name>Entity</Name>
<UnknownMemberName>Unknown</UnknownMemberName>
<Attributes>
<Attribute>
<ID>Dim Entity</ID>
<Name>Entity</Name>
<Usage>Key</Usage>
<EstimatedCount>119</EstimatedCount>
<KeyColumns>
<KeyColumn>
<DataType>Integer</DataType>
<Source xsi:type="ColumnBinding">
<TableID>shared_DimEntity</TableID>
<ColumnID>EntityKey</ColumnID>
</Source>
</KeyColumn>
</KeyColumns>
<NameColumn>
<DataType>WChar</DataType>
<DataSize>32</DataSize>
<Source xsi:type="ColumnBinding">
<TableID>shared_DimEntity</TableID>
<ColumnID>EntityValue</ColumnID>
</Source>
</NameColumn>
<AttributeRelationships>
<AttributeRelationship>
<AttributeID>IsSpecial</AttributeID>
<Name>IsSpecial</Name>
</AttributeRelationship>
</AttributeRelationships>
</Attribute>
<Attribute>
<ID>IsSpecial</ID>
<Name>IsSpecial</Name>
<KeyColumns>
<KeyColumn>
<DataType>Boolean</DataType>
<Source xsi:type="ColumnBinding">
<TableID>shared_DimEntity</TableID>
<ColumnID>IsShadowTracking</ColumnID>
</Source>
</KeyColumn>
</KeyColumns>
<NameColumn>
<DataType>WChar</DataType>
<Source xsi:type="ColumnBinding">
<TableID>shared_DimEntity</TableID>
<ColumnID>IsShadowTracking</ColumnID>
</Source>
</NameColumn>
<DefaultMember>[Entity].[IsSpecial].[False]</DefaultMember>
</Attribute>
</Attributes>
<Hierarchies>
<Hierarchy>
<ID>Hierarchy</ID>
<Name>Hierarchy</Name>
<Levels>
<Level>
<ID>IsSpecial</ID>
<Name>IsSpecial</Name>
<SourceAttributeID>IsSpecial</SourceAttributeID>
</Level>
</Levels>
</Hierarchy>
</Hierarchies>
</Dimension>
Any suggestions?
I doubt there is a way of doing this.
When changing dimension model you also modify cubes which use that dimension. Without redeploying the whole cube, metadata manager doesn't know about changes in cube.
The same situation occurs when changing dimensions in BIDS on-line - appropriate cubes are affected so they need to be deployed again.
"Recall that ROLAP partition-mode storage means that source data is not
copied to the SSAS destination. Another characteristic of ROLAP partition storage is that
aggregations are written back to relational tables in the source schema."
"To set a dimension as a ROLAP dimension, open the Dimension editor in BIDS, and in the Properties window for that dimension change the StorageMode property from the default MOLAP to ROLAP"
"though this requires Enterprise Ed of SSAS"