Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve Column Conditionally
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Retrieve Column Conditionally
Miscellaneous
Thread ID:
01519211
Message ID:
01519211
Views:
71
I have this table:
FacilityId  State StatuteDay  ActualDay   DocumentName
----------- ----- ----------- ----------- --------------------
167         FL    6           NULL        LN1FL
167         FL    15          NULL        LN2FL
167         FL    30          NULL        DNFL
167         FL    45          NULL        ADFL
167         FL    61          NULL        NODFL
0           IL    5           5           LN1IL
0           IL    15          15          LN2IL
0           IL    31          31          DNIL
0           IL    46          46          ADIL
0           IL    65          65          NODIL
0           IN    6           6           LN1IN
0           IN    25          25          LN2IN
0           IN    40          40          DNIN
0           IN    75          75          ADIN
0           IN    92          92          NODIN
169         NV    5           5           LN1NV
169         NV    15          15          LN2NV
169         NV    30          30          DN1NV
169         NV    45          45          DN2NV
169         NV    60          60          ADNV
169         NV    76          76          NODNV
169         NV    60          60          ADNV
I have this LINQ query to pull the Documents:
List<DocumentModel> retVal = null;

retVal = (from d in dc.tblDocuments
            where d.FacilityId == facilityModel.FacilityId &&
                d.StatuteDay < transactionModel.Days_Overdue &&
                !(from th in dc.tblTransactionHistories
                    select th.DocumentId).Contains(d.DocumentId)
            select new DocumentModel 
            {
                StatuteDay = d.StatuteDay,
                DocumentId = d.DocumentId,
                DocumentName = d.DocumentName,
                State = d.State
            }).ToList();
The requirements have changed, so now if the ActualDay is NULL I want to pull th StatuteDay, else use the ActualDay.

So somehow I need to introduce a ternary into this statement:
d.StatuteDay < transactionModel.Days_Overdue &&
But I'm not quite sure how. It seems like it should be something like:
d.ActualDay == null ? d.StatuteDay < transactionModel.Days_Overdue  : d.ActualDay < transactionModel.Days_Overdue
But this isn't right. Any know how to do this?

Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform