Autor Thema: Variables problem  (Gelesen 3300 mal)

Offline alecrespi

  • Junior Mitglied
  • **
  • Beiträge: 80
  • Geschlecht: Männlich
    • alecrespi
Variables problem
« am: 09.02.07 - 12:25:18 »
I think I have a problem with some variables.

When completing a ticket it starts a message like this... considering that in the MAIL SUBJECT the refer to the right ticket number is ok... I don't think what it should be wrong.
Please, help me.
Thank you



Clicca sul link per aprire il ticket ->

<<ProblemFirstLine>>
Caro <<user>>
Il Ticket <<ReqNumber>> del <<DateCreated>> è stato RISOLTO.
Per fare ciò è stata adottata questa soluzione:
<<solution>>

Offline alecrespi

  • Junior Mitglied
  • **
  • Beiträge: 80
  • Geschlecht: Männlich
    • alecrespi
Re: Variables problem
« Antwort #1 am: 13.02.07 - 17:40:07 »
I still have problems with variables.
for example I saw in different Mail Template that are used different VARIABLES for the same field.
<<ReqNumber>> 
or
<<x:ReqNumber>>

which one do I have to use?
In the previous post I tried both of them, but without the right result...
 :'(

Offline Thomas Schulte

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 4.388
  • Geschlecht: Männlich
  • Ich glaub mich tritt ein Pferd
Re: Variables problem
« Antwort #2 am: 13.02.07 - 17:46:43 »
<<x:Variable>> means keep the << >> around your value. This is needed for the subject of a mail.
<<b:Variable>> is get this variable from the basedocument
<<p:Variable>> is for getting the value from the direct parent document.

It might be that your problem is related to this one here: http://atnotes.de/index.php?topic=34332.msg216142#msg216142

There is code in that call that is a workaround for the workaround ....
Thomas Schulte

Collaborative Project Portfolio and Project Management Software

"Aber wo wir jetzt einmal soweit gekommen sind, möchte ich noch nicht aufgeben. Versteh mich recht, aufgeben liegt mir irgendwie nicht."

J.R.R.Tolkien Herr der Ringe, Der Schicksalsberg

OpenNTF Project: !!HELP!! !!SYSTEM!!  !!DRIVER!!

Skype: thomasschulte-kulmbach

Offline alecrespi

  • Junior Mitglied
  • **
  • Beiträge: 80
  • Geschlecht: Männlich
    • alecrespi
Re: Variables problem
« Antwort #3 am: 14.02.07 - 09:27:05 »
I think that thread could be useful, but I'm completely cut-out with German Language...
 :'( :'( :'(

Offline Thomas Schulte

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 4.388
  • Geschlecht: Männlich
  • Ich glaub mich tritt ein Pferd
Re: Variables problem
« Antwort #4 am: 14.02.07 - 09:32:40 »
Open the designer and search the script library lib.appl.functions
replace the function ProcessRTTags with the following code:
Code
Function ProcessRTTags(rtitem As NotesRichTextItem, linkto As NotesDocument, basedoc As NotesDocument, parentdoc As NotesDocument) As Integer
%REM
###################################################################################
Goal: Replace defined tags in richtext item rtitem with corresponding items/values from referenced docs

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Arguments: Description:
rtitem               NotesRichTextItem       RichTextItem to search for tags and replace them with appropriate values
linkto               NotesDocument            actual document
basedoc            NotesDocument           base document of actual document
parentdoc         NotesDocument            parent document of actual document
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Return:
TRUE or FALSE.
TRUE if the function runs without an error
FALSE if the function has an error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VERSION / WHEN / WHO / CHANGES

1.0/22.03.2006/Marc Aigner/--
1.1/26.04.2006/Thomas Schulte/added functionality to enter newlines with multivalue fields and replace CRLF within strings.
'###################################################################################
%END REM
'On Error 4504 Goto ERROR_4504

On Error Goto ERRHANDLE   

Const TAG_FORMULA_PREFIX = "["
Const TAG_FORMULA_SUFFIX = "]"

Dim rtnav          As  NotesRichTextNavigator
Dim rtrange         As NotesRichTextRange
Dim fieldreaddoc   As NotesDocument

Dim strT                   As String
Dim strReplT                As String
Dim strTemp               As String
Dim getString               As String   
Dim arrRetFieldNames       As Variant
Dim arrRetGetFieldFrom    As Variant
Dim ret                      As Integer
Dim retvar                  As Variant
Dim readfromitem As NotesItem
Dim CrLf As String
CrLf = Chr$(13) & Chr$(10)

ProcessRTTags = True

If Not linkto Is Nothing Then
%REM
%END REM
'/* added 28.05.2006 to avoid illegal function Call on line 425, Ulrich Krause
          ' http://atnotes.de/index.php?topic=30710.msg193619#msg193619

Dim tmpdoc As NotesDocument
Dim tmpRTitem As NotesRichTextItem
Dim tmpbody As  NotesRichTextItem   
Set tmpDoc = db.CreateDocument
Set tmpRTitem = tmpdoc.CreateRichTextItem( "tempBody" )

Dim unformatted As String
unformatted = rtitem.GetUnformattedText()
unformatted = Replace(unformatted, crLF, "")
unformatted = Replace(unformatted, Chr$(10), "")
unformatted = Replace(unformatted, Chr$(13), "")

Call tmpRTitem.AppendText( unformatted )
Set tmpbody = tmpDoc.GetFirstItem("tempBody")
      '/* end added

Set rtnav = tmpbody.CreateNavigator
Set rtrange = tmpbody.CreateRange


'Set rtnav = rtItem.CreateNavigator
'Set rtrange = rtItem.CreateRange

strTemp = ""
If rtnav.FindFirstString ( TAG_PREFIX, _
RT_FIND_CASEINSENSITIVE) Then
Do   
Call rtrange.SetBegin ( rtnav )
strTemp = strTemp + TAG_DELIMITER + Mid ( rtrange.textRun, 3, Instr( rtrange.textRun,TAG_SUFFIX ) -3 )
Loop While rtnav.FindNextString ( TAG_PREFIX, RT_FIND_CASEINSENSITIVE )
End If

arrRetFieldNames = Arrayunique ( Split ( strTemp, TAG_DELIMITER ), 5 )
Set rtrange = rtItem.CreateRange
Forall t In arrRetFieldNames
strT = Cstr ( t )
strReplT = Cstr( t )
arrRetGetFieldFrom = Arrayunique ( Split ( StrT, TAG_FIELDDELIMITER ), 5 )
Select Case arrRetGetFieldFrom(0)
Case "b"
If Not basedoc Is Nothing Then
strT = Cstr ( ArrRetGetFieldFrom(1) )
Set fieldreaddoc = Basedoc
End If
Case "p"
If Not parentdoc Is Nothing Then
strT = Cstr ( ArrRetGetFieldFrom(1) )
Set fieldreaddoc = Parentdoc                 
End If
' added 15.12.2006, Ulrich Krause. Fixes a problem with <<b: and <<p: tags as reported by AHG
Case Else
Set fieldreaddoc  = linkto
End Select
         'if no source doc referenced then use actual document
If fieldreaddoc Is Nothing Then Set fieldreaddoc = LinkTo
getstring = ""
If ( Not strT = "" ) Then
            'Check if we have a formula or a item name
If Left(Trim(strT), 1) = TAG_FORMULA_PREFIX Then
               'we have a formula string => process with source document
strT = Strleftback(Strright(strT, TAG_FORMULA_PREFIX), TAG_FORMULA_SUFFIX)
retVar = CheckAndEvaluate(strT, fieldreaddoc)
getstring = retvar(0)         
Else
               'we have a item name => use item text as value if it is a richttext else use cstr values and separate the values with chr10 chr13
' if there are multiple values in that item
If  ItemTextExists ( fieldReadDoc, strT )  Then               
Set readfromitem = fieldreaddoc.getfirstitem(strT)
If readfromitem.Type <> TEXT And readfromitem.Type <> DATETIMES And readfromitem.Type <>NUMBERS Then
getstring = fieldReadDoc.GetFirstItem(  strT ).text
Else
Forall v In readfromitem.Values
If getstring <> "" Then
getstring = getstring + "°" + Cstr(v)
Else
getstring = Cstr(v)
End If
End Forall
End If   
' replace every occurence of chr(10) + chr(13) with chr(0) in getstring
'CrLf = Chr$(13) & Chr$(10) ' Carriage Return and a Line Feed character
getstring = Replace(getstring,CrLf,"°")
' 15.11.2006, Thomas Schulte, Code added
' needed because of  issue reported here --> http://atnotes.de/index.php?topic=33526.msg210617#msg210617
Do While Right(getstring,1) = "°"
getstring = Left(getstring, Len(getstring)-1)
Loop
' End 15.11.2006, Thomas Schulte, Code added
End If
End If

            'replace tag with evaluated value from item text or formula
If Trim(getstring) <> "" Then
ret =  rtrange.FindAndReplace _
( TAG_PREFIX & strReplT & TAG_SUFFIX,_ ' find
getstring, _ ' replaceWith
RT_REPL_ALL + RT_FIND_CASEINSENSITIVE)

Call rtItem.Update ' Must update before looping
End If         
End If
End Forall

Set rtnav = rtItem.CreateNavigator
Set rtrange = rtItem.CreateRange

If rtnav.FindFirstString("°") Then
Do
Call rtrange.SetBegin(rtnav)
Call rtrange.SetEnd(rtnav)
Call rtrange.remove
Call rtitem.BeginInsert(rtnav)
Call rtitem.addnewline(1)
Call rtitem.EndInsert
Call rtitem.Update
Set rtnav = rtItem.CreateNavigator
Set rtrange = rtItem.CreateRange

Loop While rtnav.FindFirstString("°")
ERROR_4504: ' according to issue mentioned here --> http://atnotes.de/index.php?topic=33526.msg210617#msg210617
End If

End If

EXITPOINT:
Exit Function
ERRHANDLE:
ProcessRTTags = False
xProc = Getthreadinfo(LSI_THREAD_PROC)
xError = xProc  & ": " &Trim$(Str$(Err)) & " on line " & Cstr(Erl) & ": " & Error$
If UseOpenLog Then
Call LogError
Elseif LogScriptErrors Then
Call ThrowException ( xProc, xError  )
End If
Print xError   'In all cases
If ResumeMethodNext Then
Resume Next   
Else
Resume EXITPOINT
End If
End Function
Thomas Schulte

Collaborative Project Portfolio and Project Management Software

"Aber wo wir jetzt einmal soweit gekommen sind, möchte ich noch nicht aufgeben. Versteh mich recht, aufgeben liegt mir irgendwie nicht."

J.R.R.Tolkien Herr der Ringe, Der Schicksalsberg

OpenNTF Project: !!HELP!! !!SYSTEM!!  !!DRIVER!!

Skype: thomasschulte-kulmbach

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz