Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Identify messages in QM output
#1
With some 4000 user's qm-items in my qml file I was getting trouble in identifying messages, in that it concerns locating the qm-item which it gives the relevant output message. Therefore, I used the following (sample) technique in all my qm-items. Any comments and/or other more elegant techniques will be mostly appreciated. Best regards.

Function tempf10
Code:
Copy      Help
str si.getmacro(getopt(itemid) 1)
str caller.getmacro(getopt(itemid 1) 1);err    caller=si

int i=17
_s=F"Sample message to display : {i}"
min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s

ret
#2
Function outt
Code:
Copy      Help
;/
function $s [caller]

;Shows text in QM output, like out, but with prefix "<time> : <link to outt call place> - ".

;s - text. Can contain <help #IDP_F1>tags</help>.
;caller - if 1, adds link to caller's caller, not to the direct caller. It is useful if the direct caller is another 'outX' function. Can be > 1 to use another caller in the call stack.

;EXAMPLE
;int i=17
;outt F"i is {i}"


DateTime t.FromComputerTime
str st=t.ToStr(2|4)

#if EXE&&(QMVER<=0x2040303)

GetCallStack _s 1
_s.getl(_s 2+caller) ;;get caller ("<>[]this[]caller[]...")
out "<>%s : %s - %s" st _s s

#else

lpstr si=getopt(itemname -(1+caller))
if(!si) ret
if si[0]='<' ;;sub-function
,int iid=getopt(itemid -(1+caller)) ;;gets sub-function id
,_s.getmacro(iid 1) ;;gets sub-function parent name
,si=_s.from(_s ":" si+findc(si '>')+1)

int pos=Statement(1+caller)

out "<>%s : <open ''%s /%i''>%s</open> - %s" st si pos si s

#endif
#3
Perfect ! Many thanks indeed.
#4
Added parameter caller.
Added &&(QMVER<=0x2040303).
#5
Let me report that if using "Statement" it can not locate the line if used in a sub function, for example :

Macro temp01
Trigger SF7     Help - how to add the trigger to the macro
Code:
Copy      Help
outt "Main"
sub.func
outt "End"
#sub func
outt "sub"
ret

No problem if using the "GetCallStack" method.

Please advice.
#6
Corrected. Thank you.


Forum Jump:


Users browsing this thread: 1 Guest(s)