Open BenVlodgi opened 8 years ago
@BenVlodgi. Did you come with a solution on how to read Nullable fields from Excel?
No, instead I just read the text value in and used that.
public class Token
{
public string IncludeInFlex { get; set; }
public string Name { get; set; }
public string English { get; set; }
}
If I wanted to, I could then transform this object into a dataobject of my choosing (which then may use the nullable types).
public class TokenData
{
public bool? IncludeInFlex { get; set; }
public string Name { get; set; }
public string English { get; set; }
public TokenData GetFromToken(Token token)
{
return new TokenData()
{
IncludeInFlex = token.IncludeInFlex != null ?
token.IncludeInFlex.ToLower() == "yes" ? true :
token.IncludeInFlex.ToLower() == "no" ? false :
default(bool?) :
default(bool?),
Name = token.Name,
English = token.English
};
}
}
I did make a change the other day that fixed an issue with using nullable types in aggregate functions, not sure if the code changed there would help this issue specifically. I will investigate. I know this issue's old, but it would be nice if this sort of thing worked, or if at least a decent work-around was made possible.
It's telling me
'HasValue' is not a valid column name
. when I'm targeting the HasValue property of my IncludeInFlex header property of my class (which is nullable).Throws exception Message:
'HasValue' is not a valid column name. Valid column names are: 'Include In Flex', 'TokenEntry', 'en', 'de', 'F5', 'F6', 'F7', 'F8'
TargetSite:
{Boolean CheckIfInvalidColumnNameUsed(LinqToExcel.Query.SqlParts)}
StrackTrace: