iuuu presentation tip and hints
DESCRIPTION
Presentation from the Israeli User Group Event, including tips and tricks for Uniface 9.6TRANSCRIPT
Israeli Uniface UserConference
Uniface9Tips n Tricks
Avner Simon
title in dialog-Undocumented
•askmess/warning "a warning~My own title","Ok"
8,9ורסיות
Images in dropdowns
$valrep(field) = “val1=^img1·!Rep 1 ·; val2=^img2·!Rep 2“
^glyph - glyphs need to be compiled into UOBJ.
@filename - images loaded from a fileserver .
#fieldname - images loaded from a BLOB field in database.
&url - images from the web (only works in server pages).
9וורסיה •
Images in dropdowns
$fieldvalrep(listbox)="a=^U7_ENTANA !Initial Data (Entities) ;b=^U7_DTDSTD !DTDs·;c=^U7_MSCSTS !Startup Shells"
9וורסיה •
Undocumented - filebox filter
•filebox "my*.txt·;*.txt"
8,9וורסיה •
Undocumented - filebox filter
•changing the title
•filebox "my*.txt=My text files·;*.txt=Text files"
8,9וורסיה •
Undocumented - assignment files
• It is now possible to list all of the logicals at once, like this...{אפשרויות נוספות==\}list = $assignments("LOGICALS") \("FILES") \ ("DRIVER_SETTINGS") ver 9
• $print_assignments Print assignments in the transcript window ver 9
• $assignment is what uniface assembles from a couple of ASN Files
• (like usys.asn etc.)And if you have identical lines, the new ones will replace the older ones.So sometimes you may be surprised when lines are listed which you can not find in "your" ASN file. Or lines do not have the values as you see it in the ASN file.Especially (because it works on a first fit) is when you use file redirections with wildcards.
Undocumented - assignment files
SEQ ניתן להשתמש בהגדרות של DBMS connector
IDF -לצורך שמירת והפעלת קיצורי דרך פרטיים ב ver 9,8
USCUT is an entitie of the model SYSENV contain shortcuts
[DRIVER_SETTINGS]
SEQ = U1.0
[ENTITIES]
USCUT.SYSENV $SEQ:C:\USCUT9.SEQ
ההגדרות של קיצורי הדרך נשמרות בקובץ C:\USCUT9.SEQ
ערכיםשימוש ברשימה לצורך חיפוש
$list$ = "10·;100·;1000·;10000"
value to look for = 100 …. $val$ = "100"
getitem/id $25,$list$,$val$
result … $status = 2 , $25 = 100
2נמצאת במקום מספר 100המחרוזת
נוספת למצוא אם ערך קיים ללא צורך בידיעת המיקום בליסטדרך
if($item("1000", $list$ )="1000")
;TODO
endif
8,9וורסיות •
למידעיםשימוש ברשימות לופים וגזירת תכונות
variables string vList,vList1,vList2,vItemId,vItemValue,vIndex endvariables
clear/e "parts“ , retrieve/e "parts“ , setocc "parts",1
putlistitems/occ vList,"parts"
forlist/id vItemId, vItemValue, vIndex in vList
putitem vList1, -1, vItemId ; firm_code·;part_code etc’
putitem vList2,-1 ,$fieldinfo(vItemId, "DATATYPE") ; numeric·;string etc’
endfor
line.dummy = $replace(vList1,1,"·;",",",-1)
fieldstype.dummy = $replace(vList2,1,"·;",",",-1)
9וורסיה •
למידעיםשימוש ברשימות לופים וגזירת תכונות
variables string vList,vList1,vList2,vItemId,vItemValue,vIndex endvariables
clear/e "parts“ , retrieve/e "parts“ , setocc "parts",1
forentity "parts"
creocc "d",-1
putlistitems/occ vList,"parts"
forlist/id vItemId, vItemValue, vIndex in vList
putitem vList1, -1, vItemValue
endfor
line.d = $replace(vList1,1,"·;",",",-1)
endfor
line.dummy = $replace(vList1,1,"·;",",",-1)
fieldstype.dummy = $replace(vList2,1,"·;",",",-1) 9וורסיה
Performance of list processing
destructive list
while ( list != "" )
count = count+1
getitem temp,list,1
delitem list,1
Endwhile
never do a destructive list poor performance
delitem is causing the whole list to be rebuilt - very costly
getitem with a reverse destructive list
getitem temp,list,-1
delitem list,-1
much better performance
Validating a numeric string
use a syntax string to pattern match for numbers...
if ( $length(str) = 8 & str = '#*' )
;
endif
improve this even further...
if ( str = '########' )
; much better
endif
Assignment operators
Addition: c += 1 (which is the same as c = c + 1)
Subtraction: c -= 1 (which is the same as c = c - 1)
Multiplication: c *= 1 (which is the same as c = c * 1)
Division: c /= 1 (which is the same as c = c / 1)
Modulus: c %= 1 (which is the same as c = c % 1)
9וורסיה
User-defined functions
entry kms_to_mls_func
returns numeric
params
numeric kms : in
endparams
return kms*5/8
end
if(kms_to_mls_func(24) = 15)
8,9וורסיות
IF , CASE ניתן להשתמש בפונקציה ללוגיקה"
component variable or a painted field name as datatype
entry kms_to_mls_entr
paramsnumeric kms : in$miles$ : out
endparams
$miles$ = kms*5/8return 0
end
8,9וורסיות •
Nested Indirection in Field References @@ בלבד 9וורסיה
Undocumented function $ude("List2Object", "Settings")
For example ;
Compile FORELLA component with /nodebug and
generate Type 1 Proc Listing (/lis)
$1 = $ude("List2Object","Settings","ExecuteOnly=1·;listinglevel=1")
$1 = $ude("Compile", "Component", "forella")
reset passing an empty string
$1 = $ude("List2Object", "Settings", "“
9וורסיה
list of the different compiler command line sub switches
* Generate Info Messages (equal to using /inf /war):
“Messagelevel=0 “ info, warning, and error messages
“Messagelevel=1” warning and error messages (no info)
“Messagelevel=2 “ error messages (no info or warning)
* Generate Proc Listing (equal to using /lis{=2}):
"listinglevel=0" ; No Listing
"listinglevel=1" ; Type 1 Listing
"listinglevel=2" ; Type 2 Listing
* Do Not Compress Component (equal to using /noc):
"NoCompression=0" ; setting False Compress
"NoCompression=1" ; setting True do not Compress
No debug (equal to using /nodebug):
"ExecuteOnly=0" ; setting False
"ExecuteOnly=1" ; setting True
9וורסיה
DEBUG USING SELECT WATCHES
DEBUG CONDITION BREAK POINT
Extended Trace (Xtrace)
$proc_tracing
PROC_TRACING_ADDITION
[SETTINGS]
$PROC_TRACING=1
$PROC_TRACING_ADDITION="STATUS=%%$status“
$putmess_logfile =.\MAALEU9.log
"STATUS=1"(_quit) GP_TRG_QUIT:8 return (-1)
"STATUS=-1"(_quit) QUIT:2 if ($status < 0)
"STATUS=-1"(_quit) QUIT:3 return (-1)
"STATUS=0"(OPER) P_QUIT:1 macro "^quit"
Proc Profiling
Proc Profiling
REC=PROFILING,SEQ=1684,NEST=5,TYPE=TRG,MODID=tEXEC,
MODNAM=EXEC,TRIG=_execute,TRIGGER=EXEC,OBJTYPE=FRM,
APSNAM=UNI,CPTNAM=MTSAF01,INSNAM=MTSAF01
REC=PROFILING,SEQ=1681,NEST=3,ELAPSTIME=13,
ELAPSTIME_X=9,TYPE=TRG,MODID=t34\READ,MODNAM=READ,
TRIG=_read,TRIGGER=READ,OBJTYPE=FRM,APSNAM=UNI,
CPTNAM=MTMENU1B,INSNAM=MTMENU1B,ENTITY=MENU_L3,
SUBENTITY=MENU_TREE,MODEL=MAALE