?
Solved

I need to assign a value to a field in a document in lotusscrip dynamically

Posted on 2011-09-15
3
Medium Priority
?
340 Views
Last Modified: 2013-12-18
I have 100 fields in a form ., when i create a document . i need to assign values to those fields
but i dont want to write all 100 fields manually  because their name are like

field1
field2
field3
field4
.
.
.                       that goes like that

so i put a for loop in the for loop preceding the string "field"  appended by counter value of the for loop i get the name of the field and then try to assign value to it but i get the error

use of illegal property  below is my code. how can i achieve this?

      For x=0 To datacount  
            
                  doc.KHedef&Cstr(x+1)="value1"                                                             doc.Ilgilihoshin&Cstr(x+1)="value2"
                  doc.HedefBitis&Cstr(x+1)="value3"
                  doc.BasariOlcum&Cstr(x+1)="value4"
                   doc.Agirlik&Cstr(x+1)="value5"

                  
                        

      Next      
0
Comment
Question by:fatihdi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Author Comment

by:fatihdi
ID: 36544272
error screenshot
0
 
LVL 10

Accepted Solution

by:
doninja earned 1200 total points
ID: 36544336
try using doc.replaceitemvalue(itemname$,value)

you can specify the field name as a string

i.e.
in declarations
dim item as notesitem

in code
set item=doc.replaceitemvalue("KHedef"  & Cstr(x+1), "value1")

repeat for each variable you have to define.
0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 800 total points
ID: 36546578
Or, shorter

Call doc.replaceitemvalue("KHedef" & (x+1), "value1")

If would even make sense to store the strings in an array, and loop through that one too, like this:

Dim fields As Variant
fields= Split("KHedef;HedefBitis;others", ";") ' to create an array
For x=1 To datacount  +1                             ' why fro 0 to datacount?
      Forall fld In fields
            Call doc.replaceitemvalue(fld & x, "value1")
      End Forall
Next

Of course, the values can be put in an array as well...
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question