Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Confused as how to get unique value of the attribute
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
LINQ
Title:
Confused as how to get unique value of the attribute
Environment versions
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01641789
Message ID:
01641789
Views:
45
Hi everybody,

I am trying the following code that doesn't compile:
matrixTemplateViewModel.TemplateValues = _matrixTemplateValuesAdapter.GetTemplates(id).OrderBy(v => v.TmplOrder).ToList();

            matrixTemplateViewModel.RowAttributeId = matrixTemplate.PrimAxis;
            matrixTemplateViewModel.ColumnAttributeId = matrixTemplateViewModel.TemplateValues.Where(x=>x.AtnameId!=matrixTemplate.PrimAxis).
                
                Select(x => new { x.AtnameId }).Distinct().FirstOrDefault();
The TemplateValues is a list of ITmplat which has the following column of interest AtnameId. There should be two unique values in the whole set since that table represents Rows and Columns with their values.

I know the Row AtnameId (which is PrimAxis column in the other template (matrixTemplate.PrimAxis). I need to get the other attribute value for the Column which would be the distinct value of AtnameId different from PrimAxis.

So, this is the idea of my last statement but it doesn't work. Can you please help with the LINQ syntax?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform