Page 1 of 1

Date Phrase plugin

Posted: 31 Jul 2011 13:46
by LornaCraig
Running the Find Date Phrase plugin produces 'No Date Phrases Found'. But I know there are some. What am I doing wrong?

Lorna

ID:5319

Date Phrase plugin

Posted: 31 Jul 2011 15:29
by PeterR
The first line in the for ... do ... end loop is:

Code: Select all

pi:MoveTo(pi,strTypeDesc)
According to the Help file example, this line should be:

Code: Select all

pi:MoveToFirstRecord(strTypeDesc)
If you use this line instead, the Plugin does return the correct result.  I think there may be another bug in that 'nill' is used instead of 'nil'.

Date Phrase plugin

Posted: 31 Jul 2011 17:37
by LornaCraig
Thanks Peter, that fixes it. I now have a long list of date phrases!

Lorna

Date Phrase plugin

Posted: 31 Jul 2011 20:07
by Jane
Good Catch.

I'll fix the master copy when I get a moment.

Pre-Beta some of the functions got changed around and I think that's a hang over I missed.

edit: done

Date Phrase plugin

Posted: 01 Aug 2011 08:11
by Jane
Lorna,

Don't forget you can use a Plugin to fix the problems pretty easily, if you don't want to edit them manually, you just add them into the main loop

So for example if you have ABT. 1905 you can fix it using the code below.

Code: Select all

            -- Clean up date
            iYear = nil
            iYear = tonumber(string.match(strPhrase,'%d%d%d%d'))
            print(strPhrase,iYear)
            if iYear ~= nill then
               -- Got a Year
               if string.find(strPhrase,'ABT.') then
                  dpDatePoint:SetValue(iYear)
                  dtDate:SetSimpleDate(dpDatePoint,'approximate')
                  fhSetValueAsDate(pi,dtDate)
               end
            end