Similar SCATTER/GATHER en HMG

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2028
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 74 times
Been thanked: 11 times
Contact:

Similar SCATTER/GATHER en HMG

Post by danielmaximiliano » Wed May 05, 2010 7:11 pm

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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
danielmaximiliano
Posts: 2028
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 74 times
Been thanked: 11 times
Contact:

Post by danielmaximiliano » Wed May 05, 2010 7:19 pm

Me olvide pasar otro link con respecto a mi consulta
http://support.microsoft.com/kb/550158/es
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.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
Been thanked: 1 time

Post by dhaine_adp » Wed May 05, 2010 7:52 pm

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: 2028
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 74 times
Been thanked: 11 times
Contact:

Post by danielmaximiliano » Wed May 05, 2010 9:02 pm

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

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
Rathinagiri
Posts: 5148
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 124 times
Been thanked: 126 times
Contact:

Post by Rathinagiri » Thu May 06, 2010 3:20 am

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

Post Reply