create cursor c_effe ( effe1 i, effe2 c(10) ) > >insert into c_effe values ( 1234, 'hoihoi' ) > >* This browse will crash immediately: 'Variable is not found' >browse fields ; > calcfield = somefunc( effe1 ) > >* This browse will crash when clicking on the second column: 'Variable is not found' >* Also note that tabbing will not select the second column. >*browse fields ; > effe1, ; > calcfield = somefunc( effe1 ), ; > effe2 > >* This browse too will crash when clicking on the second column: 'Variable is not found' >*browse fields ; > effe1, ; > calcfield = somefunc( effe1 ) :P='999,999,999', ; > effe2 > >* This browse will not crash. >*browse fields ; > effe1, ; > calcfield = transform( somefunc( effe1 ), '999,999,999' ), ; > effe2 > >* This browse will also not crash. >* Somefunc2() handles a character type field. >*browse fields ; > effe1, ; > calcfield = transform( somefunc( effe1 ), '999,999,999' ), ; > calcfield2 = somefunc2( effe2 ), ; > effe2 > >* But this browse will crash. The only difference with the previous line >* is that somefunc2() now receives a numerical value. >*browse fields ; > effe1, ; > calcfield = transform( somefunc( effe1 ), '999,999,999' ), ; > calcfield2 = somefunc2( effe1 ), ; > effe2 > >* This browse will not crash. >* Once more, the transform() appears to have a beneficial effect. >*browse fields ; > effe1, ; > calcfield = transform( somefunc( effe1 ), '999,999,999' ), ; > calcfield2 = transform( somefunc2( effe1 ) ), ; > effe2 > >return > > >function somefunc( tnValue ) > RETURN tnValue * 2 > >function somefunc2( tnValue ) > RETURN 'hoihoi'Workaround, force VFP to use a expressions:
... calcfield = (somefunc( effe1 )) ....