@DbLookUp en lS

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

@DbLookUp en lS

Messagepar gui06 » 28 Nov 2006 à 15:31

Bonjour,

Quel est la fonction équivalente au @DbLookUp en LS?
Dernière édition par gui06 le 30 Nov 2006 à 13:55, édité 1 fois.
gui06
Posteur néophyte
Posteur néophyte
 
Message(s) : 56
Inscrit(e) le : 19 Juil 2006 à 08:08

Messagepar Stephane Maillard » 28 Nov 2006 à 16:08

Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar Michael DELIQUE » 28 Nov 2006 à 16:48

salut

le site est sympa mais payant...

mais pour un deblookup en ls voir du coté de notesview.getalldocumentbykey
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Messagepar Stephane Maillard » 28 Nov 2006 à 16:55

Salut,
Michael DELIQUE a écrit:le site est sympa mais payant...
Comment ça ? J'ai les réponses et je n'ai rien payé.
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar Michael DELIQUE » 28 Nov 2006 à 17:03

ben ovila ce que j'ai ! ou alors ya un truc que je loupe
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Messagepar Stephane Maillard » 28 Nov 2006 à 17:16

Re,

Bah dsl alors.
Accepted Answer from Bozzie4
Date: 11/23/2005 11:16AM PST
Grade: A
Accepted Answer


Yes, but it requires more lines of code - this is an example of a function that would do more or less the same.

function dblookup( db as notesdatabase, viewname as string, key as variant, resultfield as string) as variant
dim view as notesview
dim coll as notesdocumentcollection
Set view = db.getview( viewname )
dim result() as variant
dim count as long
count=0

set coll = view.getalldocumentsbykey( key, true )
redim result(coll.count)
if coll.count = 0 then
result(0)=""
else
set doc = coll.getfirstdocument()
do while not doc is nothing
result(count) = doc.getitemvalue( resultfield )
loop
end if

dblookup=result
end function

cheers,

Tom

Assisted Answer from mbonaci
Date: 11/24/2005 08:04AM PST
Grade: A
Assisted Answer


I wrote it a few months ago and saved it to my Code Library (which you can download, as a template, on OpenNTF - http://www.openntf.org/Projects/pmt.nsf ... %20Library ):

Function dbColumn( db As NotesDatabase, viewName As String, columnNo As Integer, flgUnique As Boolean ) As Variant
'Mb¤, 30.08.2005.
'Works like @DbColumn
On Error Goto ErrHandler
Dim tmpStr As String, strDbPath As String

strDbPath = Strleftback( db.FilePath, "\" ) & "\\" & db.FileName

If flgUnique Then
tmpStr = |@Unique( @DbColumn( "" : "NoCache"; "| & db.Server & |" : "| & strDbPath & |"; "| & viewName & |"; | & columnNo & | ) )|
Else
tmpStr = |@DbColumn( "" : "NoCache"; "| & db.Server & |" : "| & strDbPath & |"; "| & viewName & |"; | & columnNo & | )|
End If

dbColumn = Evaluate( tmpStr )

Exit Function
ErrHandler:
'write your own cuz I use my function
End Function

Comment from mbonaci
Date: 11/24/2005 08:06AM PST
Comment


Oh sorry dblookup, not column.
But you can easely change it...

Hope this helps,
Marko

Comment from Jaziar
Date: 11/28/2005 08:09AM PST
Author Comment


Guys I am going to increase the points on this one, I know very little about LotusScript, but I am pretty sure what I need has to be written in script (maybe Javascript) can you help me how to put the functions in a action or give me a better way of doing the task.

here is what I am trying to do and I am badly in need of help.

on my main view, I have a action button, below is what I am wanting it do to.

I want to do something like a dblookup
test := @DbLookup("":"NoCache";""; "(UserRole)"; @UserName; "UserRole");

test value can be "AA", "Manager", "Employee" depending on who is clicking the button.

if test is equal to anything other than AA - I want to set the field Manager (which is on the opening document) to UManager (this is a value in UserRole view)

if test is AA (this is the hard part) I need for a dialogbox or picklist or something where the user can select a name from a list. This list of names are coming from a value/field names AAManager which is also in the UserRole view. after they select a name then I want to set the value of Manager on the opening form to the selected value.

AAs are assistants where I work and they are assigned mutiple managers to work for, when a AA creates a docuement, the form needs to know which manager the document is being created for, that is why I need the picklist/dialog/something, so the AA can pick the manager

if the manager or a employee creates a document all I need is thier manager, which is UManager to be placed on the form


I am very stuck on this and need as much help as you can give

Comment from Jaziar
Date: 11/28/2005 10:50AM PST
Author Comment


I got this working by using logic from both of the above answers
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar oguruma » 30 Nov 2006 à 09:47

tu trouveras cela dans searchdomino
c'est gratos
il te faut créer un compte c'est tout !
tu as tout cela, on passe par les DOM
j'ai trouvé cela...
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar Wildcat » 20 Sep 2010 à 15:51

Il manque un bout à la boucle du dblookup :
count = count + 1
Set doc = coll.GetNextDocument( doc )
Avatar de l’utilisateur
Wildcat
Premier posts
Premier posts
 
Message(s) : 19
Inscrit(e) le : 06 Jan 2010 à 11:11
Localisation : Montpellier


Retour vers Développement