un truc tout bête

Forum destiné aux questions sur le développement : Formules, LotusScript, Java ...

un truc tout bête

Messagepar yop » 28 Avr 2003 à 16:38

j'ai un agent LS faisant appel à une fonction LS.ex:dans initialize, j'ai un call fonction(var1,var2)dans ma fonction, il me retourne var = var1+var2si je fais msgbox var dans la fonction à la fin, j'affiche la somme varpar contre, si je fais msgbox var dans la suite de mon agent, il ne me retourne pas la valeur.comment hérite-t-on du résultat d'une sous-fonction dans la suite d'un agent ?merci.
yop
 

Re: un truc tout bête

Messagepar Raziel » 28 Avr 2003 à 16:47

Salut,Voici un exemple :Function Somme (Var1 as integer, var2 as integer) as integerSomme = Var1 + Var2end functionSub initializeTotal as integerTotal = Somme(10, 15)msgbox (str(Total))end sub
Raziel

L'administration est un lieu ou les gens qui arrivent en retard croisent dans l'escalier ceux qui partent en avance. [Georges Courteline]
Avatar de l’utilisateur
Raziel
Modérateur
Modérateur
 
Message(s) : 1795
Inscrit(e) le : 21 Déc 2004 à 11:06
Localisation : Roubaix

Re: un truc tout bête

Messagepar yop » 28 Avr 2003 à 17:01

merci, ça marche, mais je n'arrive pas à l'adapter.quelque chose doit m'échapper.voici ma fonction :Function RS(chaine As String, avant As String, apres As String) As String Dim gauche As String, droite As String, tout As String Dim i As Variant i = False Do Until i = True If Instr(chaine,avant) = 0 Then i = True Else gauche = Left(chaine,Instr(chaine,avant)-1) droite = Right(chaine,Len(chaine)-(Instr(chaine,avant)-1+Len(avant))) tout = gauche+apres+droite chaine = tout End If Loop final = chaineEnd Functionelle permet de faire un replacesubstring.Voici le script :Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim vue As NotesView Dim doc As NotesDocument Dim item As Variant Dim body As NotesMimeEntity, value As NotesMimeEntity Dim html As String Set db = session.CurrentDatabase session.ConvertMime = False Set vue = db.GetView("($Inbox)") Set doc = vue.GetFirstDocument While Not (doc Is Nothing) If doc.Subject(0) = "Sujet" Then Set item = doc.GetFirstItem("Body") Set body = item.GetMimeEntity Set value = body.GetFirstChildEntity html$ = value.ContentAsText test$ = RS(html$,"<HTML>","") Msgbox test$ End If Set doc = vue.GetNextDocument(doc) WendEnd Suble test$ me retourne une chaine vide ??
yop
 

Re: un truc tout bête

Messagepar Raziel » 28 Avr 2003 à 17:07

Dans ton cas, pour pouvoir récupérer la valeur en sortie, il faut qu'à un moment, tu ai un truc du genre :RS = FinalRemplace :Function RS(chaine As String, avant As String, apres As String) As StringDim gauche As String, droite As String, tout As StringDim i As Varianti = FalseDo Until i = TrueIf Instr(chaine,avant) = 0 Theni = TrueElsegauche = Left(chaine,Instr(chaine,avant)-1)droite = Right(chaine,Len(chaine)-(Instr(chaine,avant)-1+Len(avant)))tout = gauche+apres+droitechaine = toutEnd IfLoopfinal = chaineEnd Functionpar :Function RS(chaine As String, avant As String, apres As String) As StringDim gauche As String, droite As String, tout As StringDim i As Varianti = FalseDo Until i = TrueIf Instr(chaine,avant) = 0 Theni = TrueElsegauche = Left(chaine,Instr(chaine,avant)-1)droite = Right(chaine,Len(chaine)-(Instr(chaine,avant)-1+Len(avant)))tout = gauche+apres+droitechaine = toutEnd IfLoopRS = ChaineEnd Function
Raziel

L'administration est un lieu ou les gens qui arrivent en retard croisent dans l'escalier ceux qui partent en avance. [Georges Courteline]
Avatar de l’utilisateur
Raziel
Modérateur
Modérateur
 
Message(s) : 1795
Inscrit(e) le : 21 Déc 2004 à 11:06
Localisation : Roubaix

Re: un truc tout bête

Messagepar yop » 29 Avr 2003 à 09:47

merci, ça marche nickel.
yop
 


Retour vers Développement

cron