QueryDate in AFDatabase

Discussion created by aabrodskiy on Feb 28, 2013
Latest reply on Mar 1, 2013 by cmanhard

I am experiencing a weird behaviour with the subject, trying to figure out what am I doing wrong in this case.


Here is my code from this simple example. I have a branch in my tree, where I set an obsolete date to yesterday for my tests.


When I set a date in QueryDateTimePicker to anything before yesterday, AFTreeView actually does show that obsolete branch.


However, db.Elements[lastPath] will always return Null if it points to that obsolete branch. I have checked in the debugger, QueryDate both for the Database and for all its Elements is set correctly, I can navigate through that obsolete branch in the watch list, but still db.Elements[anything_below_that_obsolete_branch] always returns Null. Any idea what's wrong? AFSDK version is 2.4

               string lastPath = afTreeView.AFSelectedPath;
                db = db.ApplyQueryDate(QueryDateTimePicker.Value);
                afTreeView.AFRoot = db.Elements[@"ModelTemplateStructures"];
                if (!string.IsNullOrEmpty(lastPath) && (db.Elements[lastPath] != null))
                    afTreeView.AFSelect(db.Elements[lastPath], db.Elements[lastPath].Parent, lastPath);