Similar SCATTER/GATHER en HMG

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Similar SCATTER/GATHER en HMG

Post by danielmaximiliano »

Hola a Todos:
mi pregunta es si hay algo para manejar un registro completo en HMG similar a SCATTER/GATHER de Visual Foxpro.
esto es asi.
me posiciono sobre el registro y lo levanto mediante
Scatter MEMVAR
y despues de modificar todos esos datos guardo esos datos mediante
GATHER MEMVAR
dejo un link donde hay una explicacion mejor
http://www.mygnet.net/articulos/foxpro/ ... rios_i.349

Gracias DaNiElMaXiMiLiAnO
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Similar SCATTER/GATHER en HMG

Post by danielmaximiliano »

Me olvide pasar otro link con respecto a mi consulta
http://support.microsoft.com/kb/550158/es
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: Similar SCATTER/GATHER en HMG

Post by dhaine_adp »

Hi Daniel,

I don't exactly get what you are saying but if you are looking for a similar function of VF scatter() and gather() I think that there is none. However you can easily make one for you. Here is the one that I am using similar to scatter and gather. However to differentiate it from Visual Foxpro the function names is Fld2Var() and Var2Fld().

Fld2Var() is similar to scatter()
Var2Fld() is similar to gather()

You can rename the function to scatter and gather respectively if you wish. It is a clipper code that I wrote when Clipper 5 is released. Since then I never rewrote those functions and works fine with Harbour and even with HMG.

Here is the codes:

Spanish by Google:

No exactamente conseguir lo que usted está diciendo, pero si usted está buscando una función similar de dispersión VF () y recoger () Creo que no hay ninguno. Sin embargo usted puede hacer fácilmente una para usted. Aquí es el que estoy usando similar a la dispersión y recopilar. Sin embargo, para diferenciarla de Visual FoxPro los nombres de función es Fld2Var () y Var2Fld ().

Fld2Var () es similar a la scatter()
Var2Fld () es similar a gather()

Puede cambiar el nombre de la función de dispersión y se reúnen, respectivamente, si así lo desea. Es un código de clipper que escribí cuando Clipper 5 es puesto en libertad. Desde entonces nunca volvió a escribir esas funciones y funciona bien con el puerto e incluso con HMG.

Code: Select all

****************
function FLD2VAR

   PARAMETERS NewRec, aValidFlds

   LOCAL RecMark    := RECNO(),;
         Kounter    := 1,;
         aFldValues := ARRAY(FCOUNT())

   IF NewRec == TRUE
      DBGOBOTTOM()
      DBSKIP()
   ENDIF
   IF VALTYPE(aValidFlds) = "U"
      AEVAL(aFldValues,{ || aFldValues[Kounter++] := FIELDGET(Kounter)})
   ELSE
      FOR Kounter = 1 TO LEN(aValidFlds)
         aFldValues[aValidFlds[Kounter]] := FIELDGET(aValidFlds[Kounter])
      NEXT
   ENDIF
   IF RecMark > 0
      DBGOTO(RecMark)
   ENDIF
   RELEASE ALL EXCEPT aFldValues
   RETURN aFldValues



****************
function VAR2FLD

   PARAMETERS EditVars, aValidFlds

   LOCAL tBuffer := "",;
         Kounter := 1

   IF VALTYPE(aValidFlds) = "U"
      AEVAL(EditVars,{ | tBuffer | FIELDPUT(Kounter++,tBuffer)})
   ELSE
      FOR Kounter = 1 TO LEN(aValidFlds)
         FIELDPUT(aValidFlds[Kounter],EditVars[aValidFlds[Kounter]])
      NEXT
   ENDIF
   RELEASE ALL
   RETURN NIL

Here is a pseudo sample of how you can use those two functions:

Code: Select all

#define BlankRecord    .T.
#define CurrentRecord  .F.

function Main()

local aThisFields_

use sample alias SAMPLE new
go top
aThisFields_ := Fld2Var(BlankRecord)     // retrieve a copy of blank fields to array
aThisFields_ := Fld2Var(CurrentRecord)   // retieve a copy of current record to array
aThisFields_ := Fld2Var(CurrentRecord, { 1, 3, 6, 22 } )  // retrieve selected columns in the current record position
.
.
do your desired record editing
and then save the changes made
.
.
Var2Fld( aThisFields_ )
SAMPLE->( dbclosearea() )
return


Regards,

Danny
Regards,

Danny
Manila, Philippines
User avatar
danielmaximiliano
Posts: 2607
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Similar SCATTER/GATHER en HMG

Post by danielmaximiliano »

Gracias danny, esta noche seguire tu consejo
un abrazo
DaNiElMaXiMiLiAnO
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Similar SCATTER/GATHER en HMG

Post by Rathinagiri »

Neat and simple Danny. Nice. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply