I have to take sum value from a picklist i have done it using forumla but i need to convert it to lotusscript. The formula is as below:FIELD txtCountrySecurityGrpList := txtCountrySecurityGrpList ;
FIELD txtSubsidiaryCountry := txtSubsidiaryCountry ;
SelectCountry := @Prompt([OkCancelList] ; "Countries for "+txtParentName ; “Select the Country for this Country Profile.” ;
txtSubsidiaryCountry ; txtCountrySecurityGrpList) ;
@SetField(“txtSubsidiaryCountry” ; @If(SelectCountry = 1 ; txtSubsidiaryCountry ; SelectCountry)) ;
@Command([ViewRefreshFields])
Can sum1 gimme a corresponding lotusscript for same.
Thanks in advance…
Subject: Select from Prompt method, LotusScript (how-to)
EDIT: Code has been corrected in a few spots. HTH.
Hi Anshul,
You really should learn to do this yourself, but I’m in a good mood so I wrote an example code for you. This isn’t tested but shouldn’t need much tweaking in order to work. Since answer() is a variant you need to refer to answer(0) in order to get to the response that the person picked.
There’s probably a more elegant way of doing this - but here you go…
Trish P.
Dim s As New NotesSession
Dim uiws As New NotesUIWorkspace
Dim uidoc as NotesUIDocument
Dim ThisDoc as NotesDocument
Dim txtParentName as String
Dim txtSubsidiaryCountry as String
Dim txtCountrySecurityGrpList Variant
Dim ValueList as Variant
Dim DefaultValue as String
Dim CountryTemp as String
Dim PromptTitle as String
Dim Prompt as String
Dim answer as variant
Dim x as integer
Set db = s.CurrentDatabase
Set uidoc = uiws.CurrentDocument
Set ThisDoc = uidoc.Document
txtParentName = ThisDoc.txtParentName(0)
txtSubsidiaryCountry = ThisDoc.txtSubsidiaryCountry(0)
txtCountrySecurityGrpList = ThisDoc.txtCountrySecurityGrpList(0)
x = 0
CountryTemp = ThisDoc.txtCountrySecurityGrpList(x)
While Not CountryTemp is Nothing
Redim Preserve ValueList(x + 1)
ValueList(x) = CountryTemp
x = x + 1
CountryTemp = ThisDoc.txtCountrySecurityGrpList(x)
Wend
PromptTitle = "Countries for " + txtParentName
Prompt = "Select the Country for this Country Profile."
DefaultValue = txtSubsidiaryCountry
answer = uiws.Prompt( PROMPT_OKCANCELLIST , PromptTitle , Prompt , DefaultValue, ValueList )
Call uidoc.refresh