Autor Thema: Fulltrim funktioniert nicht im Web?  (Gelesen 2504 mal)

Offline animate

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.540
  • Uh, I'm just gonna go find a cash machine.
    • LA2
Fulltrim funktioniert nicht im Web?
« am: 30.03.04 - 15:28:32 »
ich war gerade nahe am Nervenzusammenbruch.
Ich benutze die Fulltrim-Funktion, um leere Einträge aus Arrays zu schmeißen.

Klappt im Client.
Klappt nicht im Web. Zumindestens bei mir.

Kann das jemand bestätigen?

Client 6.0.2CF2

Server ist 5.0.12
Thomas

Fortunately, I'm adhering to a pretty strict, uh, drug, uh, regimen to keep my mind, you know, uh, limber.

Offline animate

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.540
  • Uh, I'm just gonna go find a cash machine.
    • LA2
Re:Fulltrim funktioniert nicht im Web?
« Antwort #1 am: 30.03.04 - 20:37:34 »
ich bin wieder bei Sinnen. Deshlab eine etwas genauere Erklärung, vielleicht auch als kleinen Tip, solltet ihr mal dieses Problem haben.

Ich habe eine Aktionsschaltfläche in einer Maske, die per Formel einen Agent aufruft. Je nachdem, ob ich im Web oder im Notes-Client bin, ist das ein anderer Agent.  

Dieser Agent wiederum (egal, ob Notes oder Web) benutzt Klassen aus einer Scriptbibliothek.

Eine Methode so einer Klasse bekommt von mir ein Array (als Variant getarnt) übergeben und soll schauen, ob da was drin ist, also ob irgendwelche Werte drinstecken.

Die Funktion macht ein Fulltrim auf den Variant, um leere Einträge rauszuschmeißen. Es kann nämlich vorstellen, dass der Variant z.B. 7 Felder hat, aber nur in 2 was drinsteht. Fulltrim stutzt, normalerweise, den Variant auf 2 Felder zurecht.

Dann prüfe ich einfach, ob Len(vaValues(0)) > 0.

Im Notes-Client klappt das - der Array wird beschnitten.
Wenn diese Funktionen allerdings übers Web aufgerufen werden, dann tut sich nix. Nada. Niente. Rien. Nothing.

Also passt auf mit Fulltrim.
« Letzte Änderung: 31.03.04 - 21:25:44 von Thomas Völk »
Thomas

Fortunately, I'm adhering to a pretty strict, uh, drug, uh, regimen to keep my mind, you know, uh, limber.

Glombi

  • Gast
Re:Fulltrim funktioniert nicht im Web?
« Antwort #2 am: 26.05.04 - 20:16:58 »
Fulltrim produziert bei Arrays vom Typ Variant unter 5.x Fehler. Daher läuft Deine Anwendung im Client (da Notes 6 Clients), aber nicht im Browser (da Notes 5 Server).
Aus der KBASE:
Using a Variant Array in the LotusScript FullTrim Function Can Cause the Error: "Type Mismatch"

A call to the LotusScript FullTrim function can sometimes result in the following error:
 
"Type Mismatch."

Further research indicates that this occurs only when a Variant array is passed as the parameter, and the elements of the array contains no text other than spaces, tabs or newline characters.

For example:

Dim d(1) As Variant
d(0)=" "
d(1)=""
result=Fulltrim(d)



This issue has been reported to Lotus Software Quality Engineering.   An attempt to fix this issue was made in Notes Domino 5.0.10, however, the fix resulted in undesired results in some cases and the fix was backed out in Notes Domino 5.0.11.  Further attempts to fix this are being researched.

Workaround:
If the application allows, use a String array rather than a Variant array.

Supporting Information:

Additional code examples:

This code works without causing the error (since there is at least one element with a character other than a space, tab or newline).

Dim d(1) As Variant
d(0)=" "
d(1)="xyz"
result=Fulltrim(d)

This code works without causing the error because a String array is used:

Dim d(1) As String
d(0)=" "
d(1)=""
result=Fulltrim(d)


This code works without causing the error because a single variable Variant is used:

Dim d As Variant
d=" "
result=Fulltrim(d)


Excerpt from the Notes R5 On-Line Help:

FullTrim function  
Takes an array and eliminates "empty" entries, or takes a string and eliminates duplicate, trailing and leading whitespace.
Syntax
FullTrim( v As Variant ) As Variant
Element
v
Any Array, String, or Variant containing a String.
Return value
A Variant containing a Array or String. If you pass in a String, you get back a String.
If you pass in an Array, you get back an Array.
Usage
Empty for strings is the Empty string.
Empty for numbers is the value 0.
Empty for Variants containing the above are the same. As Well as NULL and Empty.
The  FullTrim Trims strings by eliminating any duplicate whitespaces (SPACE, TAB, NEWLINE) from the center of the string and all whitespace at the beginning and end of the strings.
The number of elements in a returned array may vary as empty elements are removed. If all the elements are removed, an array with one empty element is returned.
 
Related Documents:

The Recipient of a Memo Is Also Added to the CC Field on a 'Reply To All' in Notes 5.0.10
Document #:  1102557


Offline animate

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 1.540
  • Uh, I'm just gonna go find a cash machine.
    • LA2
Re:Fulltrim funktioniert nicht im Web?
« Antwort #3 am: 26.05.04 - 20:31:04 »
Danke fürs nachschauen Glombi, aber das ist es leider auch nicht.

Ich bekam keine Fehlermeldung ('type mismatch') und meine Arrays enthielten Strings mit Buchstaben und Strings, die leer waren.

Aber ist nicht so schlimm, ich hab damals halt selber ne Fulltrim - Funktion geschrieben (glaub ich).
Ich bin seitdem vorsichtig mit der Funktion (ich konnte auch mal reproduzierbar rote Todesfenster mit der Funktion herstellen, auch das zwingt mich zur Vorsicht mit Fulltrim)
Thomas

Fortunately, I'm adhering to a pretty strict, uh, drug, uh, regimen to keep my mind, you know, uh, limber.

Offline koehlerbv

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Re:Fulltrim funktioniert nicht im Web?
« Antwort #4 am: 26.05.04 - 21:20:26 »
Das (angekündigte) Resultat von FullTrim ist nicht richtig brauchbar, die erhaltenen Resultate sowieso nicht - ich habe da ganz fix die Finger davon gelassen und eigene Routinen geschrieben, die dann noch weitere Prüfungen gleich mit erledigen ...

Meine Meinung: FullTrim ist ein netter Versuch, aber dilletantisch ausgeführt.

Bernhard

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz