LINQ Help!!

Dec 17, 2009 at 1:04 PM

I am a bit of a dunce and I cannot seem to get a LINQ query together to return the results that I want.

Here is the query I am working with...



                 var results = from prr in stdf.GetRecords().OfExactType<Prr>()


                              from ptr in prr.GetChildRecords().OfExactType<Ptr>()

                              let result = ptr.Result

                              where result != null

                              select new { testNumber = ptr.TestNumber,

                                           testHead = ptr.HeadNumber,

                                           testSite = ptr.SiteNumber,

                                           testText = ptr.TestText,         

                                           testResult = ptr.Result,

                                           testUnits = ptr.Units,

                                           lolimit = ptr.LowLimit,

                                           hilimit = ptr.HighLimit };



This returns the results from the ptr just fine, but what I ultimately want to do is group these results by PartId from the Prr record so that I can iterate through the results and get the above fields by partid. I cannot seem to get this to work correctly.


Any help from you LINQ experts would be much appreciated!



Dec 17, 2009 at 2:25 PM

Nevermind guys... I screwed around a bit and figured it out. I guess it is due to my utter lack of experience with LINQ queries...

var results = from prr in stdf.GetRecords().OfExactType<Prr>()

from ptr in prr.GetChildRecords().OfExactType<Ptr>()

group ptr by prr.PartId;


this works exactly the way I needed it to work. How simple was that?


Dec 18, 2009 at 5:06 PM

Glad you were able to figure it out.  I'm currently on vacation and didn't see this until today.

Let me know how the performance of that query works for you.  We have a prototype that optimizes these types of queries where data is grouped by part and we're working on folding those optimizations into the Main branch.

Dec 23, 2009 at 3:35 PM

Hey Mark -


The query works good. I have another question.  I am basically making a wrapper dll to give parsing functionality to Excel.  My company does not want to invest in a galazy license to do this, so I am stuck with this task. Your engine works tremendously, but not being very LINQ savy, it is a tough haul for me. But I keep plodding through. To make a long story more to the point, I have various different versions and types of STDF files. When I say types we have Packaged Device files, Wafer files, Pin Maps. Since we have both analog testers and digital testers, some files have FTR's associated with them.

What would be the best method to query the record types in the stdf file and follow sequence base upon the record types found? For example, the first record found is the FAR, so then go and run the parse FAR function (this returns information in the file in a comma delimited string).


Also, I cannot find the BuiltInFilters.PopulatePtrFieldsWithDefaults in the object model. Is this in a different version?