>Thisform.pf1.tx.SetAll("dynamicbackcolor","IIF(MOD(thisform.getbackcolor(ptt1.tx_date,'ptt1'),2)=0,RGB(212,237,218),RGB(255,255,255))", "Column") >>
>LPARAMETERS tdate, cTable > >DO CASE >CASE cTable = 'ptt1' > SELECT RECNO('tmpvisit1') as a FROM tmpVisit1 INTO CURSOR tmp WHERE tx_date = tdate >CASE cTable = 'ptt2' > SELECT RECNO('tmpvisit2') as a FROM tmpVisit2 INTO CURSOR tmp WHERE tx_date = tdate >ENDCASE > >RETURN tmp.a >>
>SELECT distinct tx_date from ptt1 into cursor tmpVisit1 order by tx_date >>
Thisform.pf1.tx.SetAll("dynamicbackcolor","IIF(MOD(thisform.getbackcolor(ptt1.tx_date,'tmpVisit1'),2)=0,RGB(212,237,218),RGB(255,255,255))", "Column")You cannot use RECNO() with the parameter within a SQL Select,
LPARAMETERS tdate, cTable PRIVATE tmp SELECT RECNO() FROM (m.cTable) INTO ARRAY tmp WHERE tx_date = m.tdate RETURN m.tmpYou should to have a index on tmpVisit1,
SELECT distinct tx_date from ptt1 into cursor tmpVisit1 && order by tx_date order is useless INDEX ON tx_date TAG PK_DATEand then this is 100x faster:
LPARAMETERS tdate, cTable SEEK(M.tdate,m.cTable) RETURN RECNO(m.cTable)and then you can remove the getbackcolor procedure:
Thisform.pf1.tx.SetAll("dynamicbackcolor"; ,"IIF(MOD(IIF(SEEK(ptt1.tx_date,'tmpVisit1'),RECNO('tmpVisit1'),0),2)=0; ,RGB(212,237,218),RGB(255,255,255))", "Column")