Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-09-15
3
Medium Priority
?
342 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 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