ampersand
ampersand
I am a non professional user (retired) of fivewin and make only programs for our local food bank
I am still programming like I did it in the nineties
How can I, in the example of a part of a procedure, after the 'say' and 'get' commands become the real record names?
select products
a=5
b=5.8
set filter to products->niet=" "
goto top
do while .NOT. eof()
cnaam2=TRIM(products->naam)
nalias=TRIM(products->alias)
@ a,5 say cnaam OF oDlg FONT oFont
@ b,12 get nalias OF oDlg SIZE 20,11 picture "999" FONT oFont
skip 1
a=a+1
b=b+1.15
enddo
I am still programming like I did it in the nineties
How can I, in the example of a part of a procedure, after the 'say' and 'get' commands become the real record names?
select products
a=5
b=5.8
set filter to products->niet=" "
goto top
do while .NOT. eof()
cnaam2=TRIM(products->naam)
nalias=TRIM(products->alias)
@ a,5 say cnaam OF oDlg FONT oFont
@ b,12 get nalias OF oDlg SIZE 20,11 picture "999" FONT oFont
skip 1
a=a+1
b=b+1.15
enddo
- Marc Venken
- Posts: 1482
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: ampersand
Hallo Jose,
Can you tell us a bit more what you are trying to do ? There are many samples out here and so we can point you to one of them in order to have a starting point.
One of the most complete and usable samples is Yunus.
Btw : Where in Belgium are you from ? I'm from Limburg.
Can you tell us a bit more what you are trying to do ? There are many samples out here and so we can point you to one of them in order to have a starting point.
One of the most complete and usable samples is Yunus.
Btw : Where in Belgium are you from ? I'm from Limburg.
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: ampersand
Dag Marc,
Ik woon in Harelbeke WVL en beheer de werking van de lokale voedselbank.
De bedoeling is een manier te vinden om de beschikbare voedingproducten opgeslagen in een bestand products.dbf op te nemen in het verkoop.dbf bestand dat de gratis afgeleverde producten per klant registreert. Voor het ogenblik heb ik een werkende procedure voor de verkoopprocedure die ik evenwel in de broncode telkens moet aanpassen als er producten bijkomen. Eenvoudiger zou zijn die te kunnen inbrengen in de verkoop procedure door verwijzing naar het producten bestand products.dbf.
Ik woon in Harelbeke WVL en beheer de werking van de lokale voedselbank.
De bedoeling is een manier te vinden om de beschikbare voedingproducten opgeslagen in een bestand products.dbf op te nemen in het verkoop.dbf bestand dat de gratis afgeleverde producten per klant registreert. Voor het ogenblik heb ik een werkende procedure voor de verkoopprocedure die ik evenwel in de broncode telkens moet aanpassen als er producten bijkomen. Eenvoudiger zou zijn die te kunnen inbrengen in de verkoop procedure door verwijzing naar het producten bestand products.dbf.
- Marc Venken
- Posts: 1482
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: ampersand
Jose,
The sample Yunus.prg in the sample dir can give you a working point. There is a Client, Item and invoice database. See the Client and use the products to add to the invoice. I think that it is almost the same idea.
Mocht Yunus niet duidelijk zijn (of beschikbaar), geef dan even een seintje...
The sample Yunus.prg in the sample dir can give you a working point. There is a Client, Item and invoice database. See the Client and use the products to add to the invoice. I think that it is almost the same idea.
Mocht Yunus niet duidelijk zijn (of beschikbaar), geef dan even een seintje...
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: ampersand
Hey Marc
I compiled the yunus.prg and of course it is a beautiful modern version of my nineties way of programming. I remember me that it was possible in the post Clipper era to transform a variable into his real record name by adding somewhere the ampersand (&) sign?
Don't you have somewhere an example of that old fashion way of programming?
José Deschutter (jds)
I compiled the yunus.prg and of course it is a beautiful modern version of my nineties way of programming. I remember me that it was possible in the post Clipper era to transform a variable into his real record name by adding somewhere the ampersand (&) sign?
Don't you have somewhere an example of that old fashion way of programming?
José Deschutter (jds)
Re: ampersand
hi
what you mean is a "Macro" where you use "&" (Ampersand)jds wrote:I remember me that it was possible in the post Clipper era to transform a variable into his real record name by adding somewhere the ampersand (&) sign?
Code: Select all | Expand
// variable
cDBF := "D:\WORK\CUSTOMER.DBF"
// use Macro
USE &cDBF
greeting,
Jimmy
Jimmy
Re: ampersand
Hi Jimmy
How can I apply this way of program on my example (part of procedure) in top of my early post
Thanks
José
How can I apply this way of program on my example (part of procedure) in top of my early post
Thanks
José
- Marc Venken
- Posts: 1482
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: ampersand
Some Code snippets from early FW ... Maybe some items that are usefull
Code: Select all | Expand
function makevar(cDbf)
for i = 1 to &cDbf->(fcount())
mveld = &cDbf->(fieldname(i))
mtemp = "M_"+&cDbf->(fieldname(i))
&mtemp = mveld
next
return(.t.)
function Stockchange(cVeld,cCode,cActie,nStockaantal)
cCode = alltrim(cCode)
If artplus->(dbseek(cCode))
cStockAlias = "artplus"
elseif artikel->(dbseek(cCode))
cStockAlias = "artikel"
else
Info("Bij artikel "+cCode+" kan de stock van "+cActie+" "+str(nStockaantal)+" niet worden weggeschreven")
return
endif
rec_lock("&cStockalias")
DO case
CASE cVeld = "MAG"
If cActie = "RESET"
&cStockalias->stockmag = &cStockalias->stockmag + nStockaantal
else
&cStockalias->stockmag = &cStockalias->stockmag + if(cActie = "PLUS",nStockaantal,-nStockaantal)
EndIF
CASE cVeld = "KLA"
&cStockalias->stockkla = &cStockalias->stockkla + if(cActie = "PLUS",nStockaantal,-nStockaantal)
CASE cVeld = "LEV"
&cStockalias->stocklev = &cStockalias->stocklev + if(cActie = "PLUS",nStockaantal,-nStockaantal)
CASE cVeld = "RES"
&cStockalias->stockres = &cStockalias->stockres + if(cActie = "PLUS",nStockaantal,-nStockaantal)
Endcase
rec_unlock("&cStockalias")
return
function showReservatie(cDoc)
select factart
set index to factart
if dbseek(cDoc)
//index on factart->magazijn to c:\marc\tempres while factart->levbon = cDoc
/*
index on factart->(recno()) to c:\marc\tempres while factart->levbon = cDoc
set index to c:\marc\tempres
factart->(dbgotop())
If factart->(flock())
nProcess:=0
DO while !factart->(eof())
If len(alltrim(factart->refnummer)) > 9
cAlias = "ARTPLUS"
else
cAlias = "ARTIKEL"
endif
&cAlias->(dbseek(factart->refnummer))
factart->stockmag = &cAlias->stockmag
factart->stocklev = &cAlias->stocklev
factart->(dbskip())
nProcess++
EndDO
msginfo("process"+str(nProcess,6))
else
msginfo("Geen Flock op het bestand : Factart")
endif
factart->(dbunlock())
factart->(dbgotop())
*/
else
msginfo("Document niet gevonden")
endif
return
for i = 1 to nElement
cI=PADL(i,2,'0')
//cMaat&cI = space(4)
cMaat&cI = stzero(aMag[i],4,0)
REDEFINE say oBtnKnop&cI prompt aMaten[i] ID 34+(2*I) OF oDlgstock
REDEFINE say oBtnMag&cI prompt stzero(aMag[i],3,0) ID 134+(2*I) OF oDlgstock
REDEFINE say oBtnKla&cI prompt stzero(aKla[i],3,0) ID 234+(2*I) OF oDlgstock
REDEFINE say oBtnRes&cI prompt stzero(aRes[i],3,0) ID 334+(2*I) OF oDlgstock
REDEFINE say oBtnLev&cI prompt stzero(aLev[i],3,0) ID 434+(2*I) OF oDlgstock
REDEFINE GET omaat&ci VAR cmaat&ci picture '999999' ID 1999+i OF oDlgstock font oFont1
next
function Pullout(cDbf,cIndex,cZoek,cVeld)
local cReturn:="Geen Data"
use &cDbf index &cIndex shared New
if &cDbf->(dbseek(cZoek))
if cDbf = "HISTORIEK"
cReturn = dtoc(historiek->datum)+" -> "+alltrim(cValtoChar(historiek->eenh_prijs))+" Code -> ( "+historiek->prijscode+" )"
else
cReturn = alltrim(cValtoChar(&cDbf->&cVeld))
endif
endif
&cDbf->(dbcloseArea())
return (cReturn)
for i = nElement+1 to 16 // clear the rest out
cI=PADL(i,2,'0')
REDEFINE say oBtnMag&cI prompt "" ID 134+(2*I) OF oDlgstock
REDEFINE say oBtnKla&cI prompt "" ID 234+(2*I) OF oDlgstock
REDEFINE say oBtnRes&cI prompt "" ID 334+(2*I) OF oDlgstock
REDEFINE say oBtnLev&cI prompt "" ID 434+(2*I) OF oDlgstock
REDEFINE say oBtnMin&cI prompt "" ID 534+(2*I) OF oDlgstock update
next
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: ampersand
Hi Marc,
Better explained:
How to transform within a do while procedure (file A) each appealed field into his real fieldname so that I can use this fieldname into an other file B.
kind regards
José
Better explained:
How to transform within a do while procedure (file A) each appealed field into his real fieldname so that I can use this fieldname into an other file B.
kind regards
José
Re: ampersand
example:
select products
goto top
do while .NOT. eof()
cnaam=TRIM(products->naam) to transform in his real fieldname
select sales
append blank
replace sales->fieldname with ....
select products
skip 1
enddo
select products
goto top
do while .NOT. eof()
cnaam=TRIM(products->naam) to transform in his real fieldname
select sales
append blank
replace sales->fieldname with ....
select products
skip 1
enddo
- Marc Venken
- Posts: 1482
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: ampersand
Jose,
I'm still not sure what you try to do
If you use aliases, maybe it is better ? I don't think that you wanne go into database object. Here a code that look like yours.
Please feel free to post if I understood you wrong.
I'm still not sure what you try to do
If you use aliases, maybe it is better ? I don't think that you wanne go into database object. Here a code that look like yours.
Please feel free to post if I understood you wrong.
Code: Select all | Expand
netopen("artikel","artcode","arttemp")
netopen("nofoto","tag01","nofototemp")
netopen("webshop","brandid","webtemp")
// ....
if webtemp->(flock())
webtemp->(dbgotop())
do while !webtemp->(eof())
lArtFound = .f.
nTel1++
cData = upper(webtemp->brandid)
if nofototemp->(dbseek(cData))
replace webtemp->new_bruto with nofototemp->new_bruto
replace webtemp->new_bruto with nofototemp->bruto
replace webtemp->new_date with nofototemp->new_date
else
nofototemp->(dbappend())
replace nofototemp->new_bruto with 1
/// ...
endif
webtemp->(dbskip())
enddo
endif
msginfo("Update van brandid gegevens : "+str(nTel1)+CRLF+"Update van Server brandid gegevens : "+str(nTelServer))
// .....
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: ampersand
Hi Marc,
It is possible that I want to obtain the impossible.
I want to use the existing name of some records in one file (by doing a do while procedure) to use/call them as existing fieldname in an other file....
Kind regards
José
It is possible that I want to obtain the impossible.
I want to use the existing name of some records in one file (by doing a do while procedure) to use/call them as existing fieldname in an other file....
Kind regards
José
- leandro
- Posts: 1719
- Joined: Wed Oct 26, 2005 2:49 pm
- Location: Colombia
- Has thanked: 11 times
- Been thanked: 3 times
- Contact:
Re: ampersand
An idea
I hope it helps you
Code: Select all | Expand
cThefuncion := "strinFunc()"
cVar := "{|| "+cThefuncion+" }"
EVAL( &cVar )
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 24.09 ] [ xHarbour 64 bits) ]
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 24.09 ] [ xHarbour 64 bits) ]