Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need Help with @GetDocField Formula -- PLEASE

168 views
Skip to first unread message

Joann Melnik

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

I'm trying to use the following formula to retrieve a number field in
a document, increment by one, and save it back to the document:

REM "Get Document Unigue ID for document which stores the next order
number";
uid := @Select (1;
@DbColumn("Notes":"NoCache";"":"";"OrderNumber";1));

REM "retrieve the next order number";
n := @GetDocField(uid; "NextOrdNumber");

REM "increment the next order number";
temp := n + 1;

REM "store the next order number back into the order number document";
@SetDocField(UID; "NextOrdNumber"; temp);

REM "return the next order number";
REM "@Return(n)";

Any idea why it doesn't seem to work? The field is assigned the value
from the @GetDocField statement, but the variable "n" is never set and
the rest of the formula never gets executed. It seems that execution
stops right after the @GetDocField statement. No matter what I do I
can't seem to get the @SetDocField part to do it's job.

Help!!! This is critical for the application im developing.

I'd prefer and email response if possible.

Thanks,

Joann Melnik
jme...@lucent.com

Gerald Lerman

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

In message <325C08...@lucent.com> - Joann Melnik <jme...@lucent.com>
writes:
:>
:>I'm trying to use the following formula to retrieve a number field in

Before we start, we need to know which version of Notes you are using.
Is it Notes 4.x or Notes 3.x? The answers may be quite different.

Notes 4.x has scripting capability and so you can do a lot without
using formulas (@functions) which are difficult to write and debug.

We will look into your question and will get back to you soon but let us know
what Notes version you are using.

Jerry and the Notes team at Lerman Associates
Westford, MA (The town that brings the world Lotus Notes!)


--->>> Up to Warp 3 with OS/2


ry...@raleigh.ibm.com

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

Joann's Formula:

REM "Get Document Unigue ID for document which stores the next order number";
uid := @Select (1; @DbColumn("Notes":"NoCache";"":"";"OrderNumber";1));

REM "retrieve the next order number";
n := @GetDocField(uid; "NextOrdNumber");

REM "increment the next order number";
temp := n + 1;

REM "store the next order number back into the order number document";
@SetDocField(UID; "NextOrdNumber"; temp);

REM "return the next order number";
REM "@Return(n)";


Try the following:

In your formula for the temp variable uid, use @Subset instead of @Select.

Reason: @Dbcolumn returns a list value, meaning the items returned are
separated with colons not semicolons, therefore if there are multiple values
in the column being returned the select function is merely going to select
every value instead of just the first value. Try this formula instead:

uid := @Subset(@DbColumn("":"NoCache";"";"OrderNumber";1);1);

Also be sure that the value being returned is in fact the unique id of the document
you
want. Do this by going to the OrderNumber view and if the first document in the
view is in fact always going to be the document you want then the above will work
fine.

One more thing, since you are returning the @DocumentUniqueId and it is a 32 Char
Hex
value, I recommend making sure that column 1 in the OrderNumber view is using the

following formula:

@Text(@DocumentUniqueID)

-Ryan
ry...@raleigh.ibm.com

Joann Melnik

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

Gerald Lerman wrote:

> We will look into your question and will get back to you soon but let us know
> what Notes version you are using.
>
> Jerry and the Notes team at Lerman Associates
> Westford, MA (The town that brings the world Lotus Notes!)
>
> --->>> Up to Warp 3 with OS/2

Sorry-- I should have included that in my original message. I'm using
Notes 4.x (4.11a i think) on an NT Server.

joann melnik
jme...@lucent.com

Joann Melnik

unread,
Oct 11, 1996, 3:00:00 AM10/11/96
to

Thanks ryan--- I checked the UID variable with an @Prompt box-- it is
getting the correct UID of the document. (I left out the @Text in my
original post, which I was actually using in the formula).

The problem appears with the statements after that. For whatever reason,
n is never getting assigned the value of the @GetDocField function. It
appears to immediately return that value as the value for the order
number field without executing the rest the statements in the formula.
I verified this with @Prompt statements after every key statement in
the formula.

I can't figure out what is going on .

joann melnik
jme...@lucent.com

Emanuele Sandri

unread,
Oct 16, 1996, 3:00:00 AM10/16/96
to

Try this:

In a calculated field of form:
FIELD DocID := @DocumentUniqueID;

In Your formula:


REM "Get Document Unigue ID for document which stores the next order number";

uid := @Select (1; @DbColumn("":"NoCache";"";"OrderNumber";"DocID"));

REM "retrieve the next order number";
n := @GetDocField(uid; "NextOrdNumber");

.....

Bye.
Emanuele Sandri.


0 new messages