1, after the new maximum serial number and assign values to the data window 2, after the new record saved to the database, update the current largest serial number Details: I created a function: wf_getmaxno () I need to show the form of a field for "BG. 10001" (when no records in the database of the initial value) If express meaning not clear I say detailed point, under the environment
CodePudding user response:
Didn't see,,,
CodePudding user response:
Strig s_dm, s_maxdm
The select Max (id) into: s_dm from table;
If the sqlca. Sqlcode=100 then S_maxdm=left (s_dm, 3) + string (integer (s_dm, 5) (right) + 1) The else S_maxdm="BG. 10001" End the if Return s_maxdm
CodePudding user response:
Write the Strig s_dm, s_maxdm
The select Max (id) into: s_dm from table;
If the sqlca. Sqlcode=100 then//empty table S_maxdm="BG. 10001"
Ls_like=string (wi_nvo_server uf_servertime (), "yyyymmdd") Ls_like ls_like="HT" + + "% " The select Max (hetonghao) into: ls_maxno The from hetongh where hetonghao like: ls_like;
If isnull (ls_maxno) then ls_maxno="" Ls_maxno=trim (ls_maxno)
If ls_maxno="" then Ls_no=left (ls_like, 10) + "001" The else Ls_3=right (ls_maxno, 3) Ls_no=left (ls_like, 10) + string (integer (ls_3) + 1, "000") End the if
Return ls_no
But for BG. 10001 won't cough up ha ha just learning soon forgive me