[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

@SetField problem

Posted on 2001-08-28
8
Medium Priority
?
433 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
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 1200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month17 days, 14 hours left to enroll

830 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