I have written a simple explore to see last split date & last split ratio for stocks in my database. For the stocks that have never had a split I get "Invalid DateTime" in the results. I know how to filter these out. However I want to know the reason for "Invalid DateTime". I want to know the problem with my code. Below you'll find the code and an screenshot.
Glad to see that it is not an inconsistency in design. As for your work around suggestion, I don't see how I can have an other_value_you_wish that represent null or empty value for a DateTime type field that does produce "Invadlid DateTime". The only option that I see is put bogus DateTime value in there.
Thanks @fxshrat, Clever. It makes sense. If we don't have a stock split, then
LastSplitDate retruns zero. Then in addtocolumn we try to format zero datetime and it outputs a string "invalid datetime". So replace that string with null we end up with the solution.
It is worth noting too that doing StrFind() for "Invalid" is bad idea because text may get localised versions on non-English installations of Windows and code relying on English text would stop working.
I always wonder why don't people read my responses. My 2-3 sentences usually have more substance than paragraphs of texts of other people. So, do yourself a favor and pay attention.
(Maybe I'm missing some essential info or I misunderstood what value in your line referred to)... GetFnData("LastSplitDate") does not return 0 on my end but negative (when LastSplitDate entry is not set in Information window).
Normally this field, if not set, has value of ZERO, as all fields initially get filled with zeros. However, if you are using 3rd party plugin, it is free to set the value of this field to any value. Plugin has total control and can do whatever it wants. If you are not using plugin and have non-zero value that is not valid date, then I don't know from where you got that value, but certainly not from AB.