why the variable cNR in GET is not equal to the variable which return function daj_nr()
DEFINE DIALOG oDlg FROM 0,0 to 180*2.05,200*2.05 PIXEL ;
TITLE If( lAppend, "Nowy", "Modyfikacja" ) FONT oFont
k1:=10
k2:=50
mn:=2.05
@ 10, k1 SAY "&Typ:" OF oDlg PIXEL
@ 10, k2 GET cTyp picture '!' when lAppend valid(eval({|| cNR:=daj_nr(cTYP), cTYP $ 'S_W'})) OF oDlg SIZE 10,12 PIXEL
@ 25, k1 SAY "&Nr:" OF oDlg PIXEL
@ 25, k2 GET cNr picture '99999' when lAppend OF oDlg PIXEL
@ 40, k1 SAY "&Nazwa:" OF oDlg PIXEL
@ 40, k2 GET cNazwa picture replicate('!',40) OF oDlg PIXEL
@ 55, k1 SAY "&Opis:" OF oDlg PIXEL
@ 55, k2 GET cOpis picture replicate('!',40) OF oDlg PIXEL
@ 70, k1 SAY "&Nr ew:" OF oDlg PIXEL
@ 70, k2 GET cNr_ew picture 'XXXXXXXXXXXXXXX' OF oDlg PIXEL
@ 85, k1 SAY "&Nr zak:" OF oDlg PIXEL
@ 85, k2 GET cNr_zak picture '99999' OF oDlg PIXEL
@100, k1 SAY "&Użytkownik:" OF oDlg PIXEL
@100, k2 GET cUZYTKOW picture replicate('!',40) OF oDlg PIXEL
@115, k1 SAY "&Ilość:" OF oDlg PIXEL
@115, k2 GET cIlosc_sk picture '999' OF oDlg PIXEL
@130, k1 SAY "&Cena:" OF oDlg PIXEL
@130, k2 GET cCena picture '999,999,999.99' OF oDlg PIXEL
@160, 60 BUTTON "&Rezygnacja" OF oDlg SIZE 50, 12 PIXEL ACTION oDlg:End()
@160, 120 BUTTON "&Zapis" OF oDlg SIZE 50, 12 PIXEL ACTION ( lSave := .T., oDlg:End() )
ACTIVATE DIALOG oDlg CENTER
//----------------------------------------------------------------------------//
static function daj_nr(cTYP)
local NR_:=0
dbsetorder(1)
dbseek(cTYP,.f.,.t.)
NR_:=nr+1
return NR_
//---------------------------------------------------------------------------//