FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour question of tDataRow
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
question of tDataRow
Posted: Wed Jul 02, 2014 07:40 AM

Hello,

I need to search for a value in all fields of the record, because I don´t know the concrete field to look for.

Is there a way to search a value in the entire contents of the fields of the record?.

Thank you. :D

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: question of tDataRow
Posted: Wed Jul 02, 2014 11:33 AM
Do you want to find which field of datarow object contains a search string? If that is what you want:
Code (fw): Select all Collapse
function FieldContaining( oRec, cText )
   
   cText    := Upper( AllTrim( cText ) )

return FieldName( AScan( oRec:aData, { |a| cText $ Upper( cValToChar( a[ 2 ] ) ) } ) )

If the result is empty, then no field contains the search text.
If not empty that is the first field containing the text.
Regards



G. N. Rao.

Hyderabad, India
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: question of tDataRow
Posted: Wed Jul 02, 2014 11:51 AM

Mr. Nages,

Thank you. The function always returned me blank, but I modified in this way:

function FieldContaining( oRec, cText )
return ( AScan( ArrTranspose( oRec:aData )[ 2 ], { |a| cText $ cValToChar( a ) } ) )

So, I check if its 0 (not found) or > 0, found.

Thanks :D

Continue the discussion