Solved

@SetField problem

Posted on 2001-08-28
8
402 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
[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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

761 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