X-Sharp/XSharpPublic

[VFP] SCATTER/GATHER problem with FIELDS LIKE clause

Opened this issue · 0 comments

BLANK clause is not working correctly together with FIELDS LIKE clause

Last SCATTER below with the BLANK clause assigns the actual value to the array element, and not the empty one. Problem is because

SCATTER TO a FIELDS LIKE O* BLANK

is translated by the preprocessor to

a := __ScatterArray( a, iif( .F., NIL, __DbFieldWild("O* BLANK",NULL_STRING,.F.)), .F. )

instead of

a := __ScatterArray( a, iif( .F., NIL, __DbFieldWild("O*",NULL_STRING,.F.)), .T. )

FUNCTION Start( ) AS VOID
	LOCAL cDbf AS STRING
	cDbf := "test"
	DbCreate(cDbf,{{"FLD","L",1,0},{"OTHER","N",10,0}})
	DbUseArea(TRUE,,cDbf)
	DbAppend();FieldPut(1,TRUE);FieldPut(2,123)

	LOCAL a 
	SCATTER TO a
	? a[1] // TRUE, OK
	SCATTER TO a BLANK
	? a[1] // FALSE, OK
	SCATTER TO a FIELDS LIKE O* 
	? a[1] // 123, OK
	SCATTER TO a FIELDS LIKE O* BLANK
	? a[1] // 123, WRONG!!

	DbCloseArea()