November Happy Hour will be moved to Thursday December 5th.

Property RelationInfo is always null in Entry

Vote:
 

                var catalogSearchParameters =
                    new CatalogSearchParameters
                        {
                            JoinType = "Inner Join",
                            JoinSourceTable = "CatalogEntry",
                            JoinTargetQuery = "(Select CatalogEntryId, CatalogNodeId, SortOrder From NodeEntryRelation) NodeEntryRelation",
                            JoinSourceTableKey = "CatalogEntryId",
                            JoinTargetTableKey = "NodeEntryRelation.CatalogEntryId",
                            SqlWhereClause = "NodeEntryRelation.CatalogNodeId=" + preferredCatalogNode.CatalogNodeId,
                            OrderByClause = "NodeEntryRelation.SortOrder DESC"
                        };
                var catalogSearchOptions = new CatalogSearchOptions {RecordsToRetrieve = int.MaxValue};
                var catalogEntryResponseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull);
                var entries = CatalogContext.Current.FindItems(catalogSearchParameters, catalogSearchOptions, catalogEntryResponseGroup);

    

in response i get multiple entries, but RelationInfo property is allways null.

Is that bug or im doing something wrong to get it?

 

PS. also tried different variations of CatalogEntryResponseGroup flags, did not help either

#59181
May 23, 2012 17:33
Vote:
 

i need to do this becasue i what to do more 'secondary' sorting in memory, but i cannot do this unless RelationInfo is not null.

#59182
May 23, 2012 17:38
Vote:
 

What we're trying to accomplish is getting a collection of Entry objects and sort them after their Sort Order property. The RelationInfo property on the Entry objects is always null no mater what. Anybody experienced this before?

Cheers

Frederik

#59184
May 23, 2012 18:04
Vote:
 
int count = 0;
var entries2 = CatalogContext.Current.FindItemsDto(catalogSearchParameters, catalogSearchOptions, ref count, catalogEntryResponseGroup);

 

    if i use this code then i can get entries2.NodeEntryRelation[0].SortOrder, but i would like to get the same data without using Dto method call

#59185
May 23, 2012 18:17
Vote:
 

I you are only trying to get the entries in order of the catalog node you could do the following.

CatalogRelationResponseGroup group = new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.NodeEntry);
CatalogRelationDto relation = CatalogContext.Current.GetCatalogRelationDto(0, nodeId, 0, "", group);
var entries = CatalogContext.Current.GetCatalogEntries(relation.NodeEntryRelation.AsEmuerable().Select(row => row.CatalogEntryId).ToArray());

    

You could also could convert the dto to an Entry[] by

entries2.CatalogEntry.AsEnumerable()
.Select(row => new Entry(row))
.ToArray();

    

#59227
May 24, 2012 22:20
Vote:
 

SortOrder is available here:

var relationInfos = entries2.NodeEntryRelation;

    

but after doing this:

var entries = entries2.CatalogEntry.AsEnumerable().Select(row => new Entry(row)).ToList();

    

entries has RealtionInfo null, i suposse becasue only catalogEntryRow is passed to constructor

 

but your idea got me to this solution:

var query = from entry in entries2.CatalogEntry.AsEnumerable()
            join rel in entries2.NodeEntryRelation.AsEnumerable() on entry.CatalogEntryId equals rel.CatalogEntryId
            select new Entry(entry) { RelationInfo = new RelationInfo { SortOrder = rel.SortOrder } };

 

so then i suppose answer to my question: if i can get RelationInfo without calling Dto method(just by calling FindItems) is 'false'

#59231
May 25, 2012 8:57
Vote:
 

No, becasue you need the full dto to be able to populate the RelationInfo.  Although if you put a repsonse group of relations or full it should pouplate the relation info.  I will take a look at that and pass on to development.

Is strange the relationinfo is not populating when passing in the row constructor, as it looks to see if there is a RelationTypeId in the table.  It does not matter that it passes just row in because it can get the related tables for the row as it does with Inventory etc.  Anyway I will dig a little deeper and get back to you  

#59250
May 25, 2012 23:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.