Thor_engine.additemtomenu bug?

Topics: Bug Information
Jul 18, 2011 at 2:42 PM

I have the latest version of Thor and decided today was the day to install the latest PEMEditor7 beta. When I ran PEMEDitor.app to install, Thor's additemtomenu method throws an error on the bold line shown below:

if vartype(tnOrder) <> 'N'
	select max(SortOrder) from MenuTools into array laOrder ;
		where MenuID = tnMenuID
->	lnOrder = nvl(laOrder[1], 0) + 1
endif vartype(tnOrder) <> 'N'

laOrder is declared as a local array at the beginning of the method. If the query returns no rows, laOrder does not get redefined and therefore remains a logical value resulting in an Operator/Operand Type Mismatch.

Instead of a null check, the datatype of the first element of the array should be tested or the first array element should be redefined as 0 before the query runs.

Coordinator
Jul 18, 2011 at 2:57 PM

Are you sure that you are using the current version, Thor Beta 4, dated yesterday?

The code in that version looks like this:

if vartype(tnOrder) <> 'N'
    select max(SortOrder) from MenuTools into array laOrder ;
        where MenuID = tnMenuID
    lnOrder = Nvl(Evl(laOrder[1],0), 0) + 1
endif vartype(tnOrder) <> 'N'

The code you posted was in fact the code from an earlier version. 

Jul 19, 2011 at 6:14 PM

I was in beta 2, Jim. I saw that beta 4 was out after I ran into this issue.