?
Solved

@SetField problem

Posted on 2001-08-28
8
Medium Priority
?
416 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
Independent Software Vendors: 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

764 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