RE: compare enum with string on query
I don't see how using the label would change anything. Any anyway it's not possible.
Could you explain how the last enumeration of DayId would cause issues? Could you share an example where the statement doesn't return you the expected result?
If jmgStampJournalTrans.StartDate is Monday, then dayOfWk(StartDat)e - 1 is 0 and it corresponds to jmgProfileSpec.DayId Monday (enum value 0)
If jmgStampJournalTrans.StartDate is Tuesday, then dayOfWk(StartDate) - 1 is 1 and it corresponds tojmgProfileSpec.DayId Tuesday (enum value 1)
If jmgStampJournalTrans.StartDate is Wednesday, then dayOfWk(StartDate) - 1 is 2 and it corresponds tojmgProfileSpec.DayId Wednesday (enum value 2)
If jmgStampJournalTrans.StartDate is Thursday, then dayOfWk(StartDate) - 1 is 3 and it corresponds tojmgProfileSpec.DayId Thursday (enum value 3)
If jmgStampJournalTrans.StartDate is Friday, then dayOfWk(StartDate) - 1 is 4 and it corresponds tojmgProfileSpec.DayId Friday (enum value 4)
If jmgStampJournalTrans.StartDate is Saturday, then dayOfWk(StartDate) - 1 is 5 and it corresponds tojmgProfileSpec.DayId Saturday (enum value 5)
If jmgStampJournalTrans.StartDate is Sunday, then dayOfWk(StartDate) - 1 is 6 and it corresponds tojmgProfileSpec.DayId Sunday (enum value 6)
But then the question is, would you like to find these "Special" records somehow? You can never find it, with enum labels or numerical values, if you search by weekdays Monday-Sunday.