Difference between revisions of "Programmazione"
Jump to navigation
Jump to search
(No difference)
|
Revision as of 20:51, 6 June 2019
Programmazione base
- Istruzioni base
- Lettura tabelle
- Gestione file e cartelle
- Gestione videate e campi
- Variabili globali predefinite
- Choose
- Entry Points
- Esempi
Programmazioni specifiche
- Aprire un URL con il browser della postazione client
- Far eseguire un comando al sistema operativo
- Stampa di un pdf
- Conoscere hostname che esegue il client
- Istruzioni SQL
- Gestione tracce
- Gestione errori a run time
- Finestre di dialogo
- Far eseguire SPV e SUB prima dello SPE
Programmazioni composte
Vengono elencate di seguito delle programmazioni che richiedono sia codice che parametrizzazione:
- Come fare debug
- Import/Export
- Gestione testata/dettaglio
- Invio mail
- Numeratori
- Transazioni su tabella
- Traduzioni
Appunti
- AFFZO: il no-lign non è necessario, aggiorna sempre tutta la colonna di una tabella
- NBLIG è il numero di riga di visualizzazione, non è uno dei campi chiave
- all'interno di una subroutine si può fare il casting tra
CLBfile(Clob) echar
da metodo chiamante a metodo chiamato invece la differenza di tipo tra argomento e parametro genera errore - E' possibile inserire delle azioni all'interno di un tipo dato: un esempio è il tipo dato YIT (con funzioni YGESTYIT, YSTRYIT, YCTRYIT)
- Per vedere in quali punti è utilizzato un tipo dato eseguire la seguente query in sql server:
select * from SAGEDEV.AMSKZON where CODTYP_o='YIT' - CONTOBJW è un'azione che permette di disattivare il controllo d'esistenza nella tabella, con parametro OBJET che deve essere impostato con il codice dell'oggetto (per azione di tipo oggetto - vedi YIC)
- CONTOBJN è un'azione che permette di disattivare tutti i controllo dell'oggetto (per azione di tipo oggetto)
- filpath(CARTELLA,nomefile,estensione) costruisce il path assoluto di un file:
se CARTELLA inizia per "\\" mantiene la cartella così come passata nel parametro
se CARTELLA inizia per "\" da un percordo del tipo "C:\CARTELLA"
se CARTELLA non inizia con la barra, da un percorso del tipo "C:\SAGE\SAGEX3\Folders\DOSSIER\CARTELLA\nomefile.estensione"
- Per recuperare il percorso base di un dossier ci sono due modi, SETPARAM o filpath:
filpath("","","")
Local Char MACHIN(20)
Local Char IRS(2)
Local Char OS(20)
Local Integer I
Local Char YDIR(250)
Call SETPARAM(YDIR,MACHIN,IRS,OS,I) From PARFICBAN
- Per andare a capo a metà di una riga di codice basta mettere come primo carattere della nuova riga un
&
[M:YI3]YFVABBR(nolign-1) = [F:YFD]YFVVALCOD + " " +func AFNC.TEXTRA("ATABDIV","SHODES","6033",[F:YFD]YFVVALCOD)
&+ " " +func AFNC.TEXTRA("ATABDIV","LNGDES","6033",[F:YFD]YFVVALCOD)
- per compilare un sorgente da codice
LOCAL Integer MYOK
CALL VALID("TRT","SPEITM", nomap, MYOK) From VALMSKSUB
- per recuperare nomi campi di un blocco (riporto codice per MEMO):
######################################################################################
# SU APERTURA FINESTRA. una sola volta
# Utilizzare abbreviazioni per tabelle NON STANDARD. cambiare AMZ in YMZ!
$OUVRE
#If GUSER='IT102' Dbgaff : Endif
# Apro le tabelle utilizzate
If !clalev ([F:YII]) : Local File YITMINF [YII] : Endif
If !clalev ([F:YII_]) : Local File YITMINF [YII_] : Endif
If !clalev ([F:YIIT]) : Local File YITMINF [YIIT] : Endif # riferimento tabella YITMINF x controllare unicità YCODARTCLI
If !clalev ([F:YITM]) : Local File ITMMASTER [YITM] : Endif
#
#Gestione di Blocchi di campi.
#Registrazione utente/data/ora inserimento/modifica/cancellazione su blocco di controlli
#
#
#Dichiarazione array con nomi campi contenuti nei riquadri da gestire
#Local Integer MAXCAMPIBLOCK : MAXCAMPIBLOCK=13
#Local Char BLKBUFFER(30)(MAXCAMPIBLOCK)
#Local Integer NRBLKYIT1
#Local Integer C
#Local Char TEST(30)
# Recuperare il numero di blocchi da gestire e loro dimensioni
#If !clalev ([F:YMZ]) : Local File AMSKZON [YMZ] : Else Filter [F:YMZ] :ENDIF
#NRBLKYIT1 = func GETNRBLOC('YIT1')
#Local Integer VIDYIT1(NRBLKYIT1)
#Local Char BLK01(30)(NRBLKYIT1)
#Local Char BLK1(30)(MAXCAMPIBLOCK)
#Local Char BLK2(30)(MAXCAMPIBLOCK)
#Local Char BLK3(30)(MAXCAMPIBLOCK)
#Local Char BLK4(30)(MAXCAMPIBLOCK)
#Local Char BLK5(30)(MAXCAMPIBLOCK)
#Local Char BLK6(30)(MAXCAMPIBLOCK)
#Local Char BLK7(30)(MAXCAMPIBLOCK)
#Local Char BLK8(30)(MAXCAMPIBLOCK)
#Local Char BLK9(30)(MAXCAMPIBLOCK)
#Local Char BLK10(30)(MAXCAMPIBLOCK)
# partire dal code by AZ
#For C=1 To NRBLKYIT1
# Call GETBLOCKNAMES('YIT1', C, BLKBUFFER) From YSS02SPEITM
# For K=0 To MAXCAMPIBLOCK-1
# #Assign 'BLK'+num$(I)+'('+num$(K)+')' With evalue('BLKBUFFER('+num$(K)+')')
# Assign 'BLK'+num$(C)+'('+num$(K)+')' With evalue('BLKBUFFER')
# Next K
#Next C
# fine inizializzazione array con nomi campi x blocco
# code by AZ
#Local Char A(30)
#MAXB = func SPEITM.GETNRBLOC('YIT1')
#Local Char BLK1(30)(10)
#Local Char BLK2(30)(10)
#Local Char BLK3(30)(10)
#Local Char BLK4(30)(10)
#Local Char BLK5(30)(10)
#Local Char BLK6(30)(10)
#Local Char BLK7(30)(10)
#Local Char BLK8(30)(10)
#Local Char BLK9(30)(10)
#Local Char BLK10(30)(10)
#Dbgaff
#For I=1 To MAXB
# A='BLK'+num$(I)
# #Call GETBLOCKNAMES('YIT1', I, evalue(A)) From SPEITM
# Call GETBLOCKNAMES('YIT1', I, BLK10) From SPEITM
# For K=0 To 9
# Assign 'BLK'+num$(I)+'('+num$(K)+')' With evalue('BLK10('+num$(K)+')')
# Next
#Next
#Infbox BLK1(0)-BLK1(1)-BLK1(2)-'#'-BLK2
#End code AZ
#Filter [F:YMZ]
#Filter [F:YMZ] Where [F:AMZ]CODMSK='YIT2' Order By [F:AMZ]NUMBLOC Desc
#Local Integer VIDYIT2(func GETNRBLOC('YIT2'))
#Filter [F:YMZ]
#Filter [F:YMZ] Where [F:AMZ]CODMSK='YIT3' Order By [F:AMZ]NUMBLOC Desc
#Local Integer VIDYIT3(func GETNRBLOC('YIT3'))
# Define variabili flag per registare se vengono fatti cambiamenti ai campi.
# IN registrazione verrà salvato il timestamp di salvataggio
Return