LINQ : Unmatched data is coming for inner join

  • Thread starter Thread starter Sudip_inn
  • Start date Start date
S

Sudip_inn

Guest
I am joining two list List.

i am joining 4 fields based on section,xfundcode,period & broker ** **cfList & QCViewAllBrokerList1 they are two List type.

Records exist in cfList for the section -> CONSENSUS MODEL, xfundcode -> RD_001, period -> 2018 FY & broker -> BW

but there is no records exist in this list QCViewAllBrokerList1 for the section -> CONSENSUS MODEL, xfundcode -> RD_001, period -> 2018 FY & broker -> BW.

so when i am doing inner join then match not found because same data does not exist in two list. as a result there no records should be stored in result variable called QCViewAllHistValue1 for the section CONSENSUS MODEL, xfundcode RD_001, period 2018 FY & broker BW.

but the problem is records exist in the list of QCViewAllHistValue1 for the section CONSENSUS MODEL, xfundcode RD_001, period 2018 FY & broker BW after inner join done.

How it is possible ? how data is storing in final result set called QCViewAllHistValue1 for the section -> CONSENSUS MODEL, xfundcode -> RD_001, period -> 2018 FY & broker -> BW

This is causing problem in my case.


var QCViewAllHistValue1 = (from frmlst in cfList
join viewalllst in QCViewAllBrokerList1
on new
{
val = String.IsNullOrEmpty(frmlst.Section) ? "" : frmlst.Section.Trim().ToUpper(),
val1 = String.IsNullOrEmpty(frmlst.xFundCode) ? "" : frmlst.xFundCode.Trim().ToUpper(),
val2 = String.IsNullOrEmpty(frmlst.Period) ? "" : frmlst.Period.Replace("A", "").Replace("E", "").Trim().ToUpper(),
val3 = String.IsNullOrEmpty(frmlst.Broker) ? "" : frmlst.Broker.Trim().ToUpper()
}
equals new
{
val = String.IsNullOrEmpty(viewalllst.ViewAllSection) ? "" : viewalllst.ViewAllSection.Trim().ToUpper(),
val1 = String.IsNullOrEmpty(viewalllst.xFundCode) ? "" : viewalllst.xFundCode.Trim().ToUpper(),
val2 = String.IsNullOrEmpty(viewalllst.ViewAllPeriod) ? "" : viewalllst.ViewAllPeriod.Replace("A", "").Replace("E", "").Trim().ToUpper(),
val3 = String.IsNullOrEmpty(viewalllst.ViewAllBroker) ? "" : viewalllst.ViewAllBroker.Trim().ToUpper()
}

select new QCHelper()
{
Value = viewalllst == null ? string.Empty : (viewalllst.Value == null ? string.Empty : viewalllst.Value),
}).ToList<QCHelper>();


Please guide me where i am making the mistake in my above linq query. thanks

Continue reading...
 
Back
Top