Solved

@SetField problem

Posted on 2001-08-28
8
398 Views
Last Modified: 2013-12-18
I have a field (FIELD1) defined as Text,Editable.

Another field (FIELD2) defined as Text,Computed,Allow Multiple Values,Hidden.

And Another field (LOCATION) defined as Numeric,Hidden


What I want to do is update FIELD2 based on the value in FIELD1 slotted with the value of LOCATION.

So, If Field1 = AAAA and Location = 1, then FIELD2 should be AAAA, Field1 is blanked and Location set to 2, if the user puts BBBB into Field1 then Field2 should be AAAA;BBBB.

I have the formula to update the field in a hotspot but the field will not update into the correct slot, it keeps getting added to the end of Field1.

The formula I am using in the hotspot is:

@SetField(@Subset("Field2";Location);Field2 + Field1 + ";");
FIELD Field1 := "";
FIELD Location := Location + 1;

@Command([FileSave])

Anyone have any ideas?

0
Comment
Question by:GaryZ
8 Comments
 
LVL 4

Expert Comment

by:martijnmulder
ID: 6432689
try:

FIELD Field2:= Field2:Field1;
FIELD Field1 := "";
FIELD Location := Location + 1;

@Command([FileSave])

 
0
 
LVL 1

Expert Comment

by:tduthie
ID: 6432931
I don't quite see the use of the Location field.  Since it is hidden, I don't see why it's necessary.

FIELD Field2:= Field2:Field1;
FIELD Field1 := "";
@Command([FileSave])

I'd completely get rid of the Location field, unless you can tell me why it's necessary.
0
 

Author Comment

by:GaryZ
ID: 6433114
The reason for the location field is to know what slot the information is slotted.

There are 3 locations, thus 3 values in the multi-value field (location 1, location 2, location 3).

When I display the field I need to know what location I am displaying and thus the appropriate value.

My problem is everytime someone clicks on the "Add Location" link it keeps adding the information to the multi-value field. Also to carry this forward, they might want to update location 2, so I need to replace that value with the new one.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Expert Comment

by:tduthie
ID: 6433228
From your comments above, I'm getting the impression, that you may be changing Location in other code.  As a result, to replace a specific member in the list requires a bit more code.

In the code below, I didn't do an @Command([FileSave]).  That's up to you if you want to do.  Also, my Location field was defaulted to "1".  You may want to check that Location is not "".

--Begin Formula--

REM "Get count in list before current location";
varSubsetBefore := Location - 1;
REM "If there are elements after current location, get count in list after current location";
varSubsetAfter := @If(@Elements(Field2) > Location; -1 * (@Elements(Field2) - Location); 0);

REM "Set Value of Field2";
FIELD Field2 :=
    @If(varSubsetBefore != 0 & varSubsetAfter != 0;
        @Subset(Field2; varSubsetBefore) : Field1 : @Subset(Field2; varSubsetAfter);

        varSubsetBefore = 0  & varSubsetAfter != 0;
        Field1 : @Subset(Field2; varSubsetAfter);

        varSubsetBefore != 0 & varSubsetAfter = 0;
        @Subset(Field2; varSubsetBefore) : Field1;

        Field1
    );

REM "Clear Field1 and increment Location";
FIELD Field1 := "";
FIELD Location := Location + 1;

@True;

--End Formula--

0
 

Author Comment

by:GaryZ
ID: 6433423
I get the same resuts with your code as mine, the multi-value field is not updated.
0
 
LVL 1

Accepted Solution

by:
tduthie earned 300 total points
ID: 6433467
What's the formula for your multi-value field?  Mine's simply "Field2".  If it's anything else, that value will always replace whatever is in the field.
0
 

Author Comment

by:GaryZ
ID: 6433738
Send me your email address at gmorrison@celinagroup.com and I will send you a small database I am using to test.
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6443914
Did you try Martijns solution ?
It should work ?
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

774 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