Can calculation fields be repeating fields?
Author Message
Can calculation fields be repeating fields?
It is possible to create a calculation fields that places its results on
different repetitions within the field, and if so how?  I have seen that
it is possible to define a calculation field as a repeating field, which
seems to suggest that it is possible, although I can find nothing in the
manual to say how nor figure out how to do it myself.

--
Bridget Eley

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?

Hi Bridget -

Without more detail, it's hard to give a specific technique for what you are
trying to do ( could you be trying to create a spreadsheet-like matrix of
repeaters? ), but I think the function GetRepetition(field) is what you are
looking for.  I hope this hint is helpful, please get back to the group with
an expansion on your question if necessary.

Best of Luck -
James

Quote:

> It is possible to create a calculation fields that places its results on
> different repetitions within the field, and if so how?  I have seen that
> it is possible to define a calculation field as a repeating field, which
> seems to suggest that it is possible, although I can find nothing in the
> manual to say how nor figure out how to do it myself.

> --
> Bridget Eley

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?

Quote:

> Hi Bridget -

> Without more detail, it's hard to give a specific technique for what you are
> trying to do ( could you be trying to create a spreadsheet-like matrix of
> repeaters? ), but I think the function GetRepetition(field) is what you are
> looking for.  I hope this hint is helpful, please get back to the group with
> an expansion on your question if necessary.

> Best of Luck -
> James

I don't think the GetRepetition(field) script step can help me.  I was
thinking more in terms of putting values into the repetitions of a calc
field, not getting them out, if that is even possible.

I am trying to find a way to create a value list for a field in a related
database that automatically reflects the values entered in 8 Global fields
in the master database by the user and therefore cannot be known in

I have temporarily solved the problem by creating a calc field that
concatenates the values from the global fields, separated by a return, and
a scripted "reset" button consisting of 8 SetField steps (6 are variations
of the Middle step):

Left(CalcField, Position(CalcField, "?", 1, 1)-1)

Middle(CalcField, Position(CalcField, "?", 1, 1)+1, Position(CalcField,
"?", 1, 2)-Position(CalcField, "?", 1, 1)-1)

Right(CalcField, Length(CalcField) - Position(CalcField, "?", 1, 7))

which takes the appropriate line from the calc field and place it in the
appropriate repetition of a repeating field, which in turn is the field
referenced by the field in the related database.

It works but it seems clumsy and of coarse, it isn't foolproof - the user
could forget to click the "reset" button and not pick up the mistake
because the values of the global field would have changed but not those of
the value list.  I could probably thinks of ways around this, but what I
would really like is a calculation field that does the job automatically,
so that any changes to the global fields in the master file are
automatically reflected in the value list of the related file.

I have tried referencing the calc field itself as the value list, but it
doesn't work, I think because the calculation includes values from global
fields which cannot be indexed.

When I saw that you could define a calc field as a repeating field, it
occurred to me that perhaps I could work out something with that, but have
no idea how to do it, and suspect that even if it was possible, it would
probably run into the same problem as the ordinary calc field (being
non-indexible).

How would you tackle it?

--
Bridget Eley

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?

<< ...How would you tackle it? >>

To put stuff into repeaters, you're going to need an index repeater to key off
of.  That is a repeater with its rep number as its value.  When you start
messing with globals and related files, your calced repeater, as you note loses
indexibility, so you may want to make it an auto enter calc, or lookup.  The
techniques and permutations are way too complex to cover here, but I just
wanted to let you know it can be done, so keep at it.

Sincerely,

Roger E. Grodin
REDWING FINANCIAL GROUP

==========================================================

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?

Quote:

> To put stuff into repeaters, you're going to need an index repeater to key off
> of.  That is a repeater with its rep number as its value.  When you start
> messing with globals and related files, your calced repeater, as you
note loses
> indexibility, so you may want to make it an auto enter calc, or lookup.  The
> techniques and permutations are way too complex to cover here, but I just
> wanted to let you know it can be done, so keep at it.

Thanks Redwing.  Nice to know it can actually be done!

--
Bridget Eley

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?
Hi Bridget -

I get the picture, I think, and Redwing is right that it is going to get
complicated.  Now that I understand better I may have an alternative solution for
you.  You have DB1, where some of the work is done, and one of the things the user
does is put eight values into eight fields ( you use globals because you want them
to be the same on every record for the duration of a session ) and then go to DB2,
a related file, to perform more work.  In DB2, you want them to be able to pick
from a value list that contains the eight values they just entered in DB1.  At the
end of the session, you want the values cleared.  Am I right?

If so, here is an idea:  create DB3, with two fields, Match ( number ) and Value (
text ).  Create a new field, Match ( number ), in DB1.  Use auto-enter or a calc to
make sure the value of Match is always 1 in every record in both DBs, and create a
one-to-many relationship DB1 --> DB3 on that field.  Then make a portal on the
appropriate layout in DB1, with eight rows and only the field Relationship::Value
showing.  Allow creation of related records, sort if you wish.  Don't add a
vertical scroll bar, so the user won't be tempted to make more than eight.  Let
them enter their eight values.  Go to DB2 and create your value list based on the
field Value in DB3, you don't even have to relate them.

You will have to delete the eight records in DB3 at the end of each session, but
you can use an external script to do that and call it from your Close script in
DB1.

What do you think?

Best of Luck -
James

Quote:

> << ...How would you tackle it? >>

> To put stuff into repeaters, you're going to need an index repeater to key off
> of.  That is a repeater with its rep number as its value.  When you start
> messing with globals and related files, your calced repeater, as you note loses
> indexibility, so you may want to make it an auto enter calc, or lookup.  The
> techniques and permutations are way too complex to cover here, but I just
> wanted to let you know it can be done, so keep at it.

> Sincerely,

>         Roger E. Grodin
>         REDWING FINANCIAL GROUP

>         ==========================================================

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?

Quote:

> To put stuff into repeaters, you're going to need an index repeater to key off
> of.  That is a repeater with its rep number as its value.  When you start
> messing with globals and related files, your calced repeater, as you
note loses
> indexibility, so you may want to make it an auto enter calc, or lookup.  The
> techniques and permutations are way too complex to cover here, but I just
> wanted to let you know it can be done, so keep at it.

Followup:  Thanks to Redwing's tip about the index repeater, I was finally
able to crack the problem.

The problem again was how to get the values of 8 global text fields in a
master file into a repeating calculation field in a related file, so that
they could be referenced as the value list of a number of other fields in
a number of other files.

Here's how:

First, I made a global repeating field with 8 reps numbered 1 through 8 in
the related file.

Then I made a text calc field in the same file as follows:

Choose(Index, "", MasterFile::Global Field 1, Extend( MasterFile::Global
Field 2), Extend( MasterFile::Global Field 3), Extend( MasterFile::Global
Field 4),Extend( MasterFile::Global Field 5), Extend MasterFile::Global
Field 6),Extend MasterFile::Global Field 7),Extend( MasterFile::Global
Field 8))

Finally, I reformatted the fields in the three other related files so that
they now reference this field as their value list.

And guess what?  It works like a charm! The fact that the fields
referenced by the calc are global fields (and hence not indexible) seems
to make no difference when you do it this way!  Bye bye clumsy script! And
thanks again, Redwing - I couldn't have done it without your instructive
nudge in the right direction!

--
Bridget Eley

Tue, 17 Dec 2002 03:00:00 GMT
Can calculation fields be repeating fields?

Quote:

> Hi Bridget -

> I get the picture, I think, and Redwing is right that it is going to get
> complicated.  Now that I understand better I may have an alternative
solution for
> you.  You have DB1, where some of the work is done, and one of the
things the user
> does is put eight values into eight fields ( you use globals because you
want them
> to be the same on every record for the duration of a session ) and then
go to DB2,
> a related file, to perform more work.  In DB2, you want them to be able
to pick
> from a value list that contains the eight values they just entered in
DB1.  At the
> end of the session, you want the values cleared.  Am I right?

> If so, here is an idea:  create DB3, with two fields, Match ( number )
and Value (
> text ).  Create a new field, Match ( number ), in DB1.  Use auto-enter
or a calc to
> make sure the value of Match is always 1 in every record in both DBs,
and create a
> one-to-many relationship DB1 --> DB3 on that field.  Then make a portal on the
> appropriate layout in DB1, with eight rows and only the field
Relationship::Value
> showing.  Allow creation of related records, sort if you wish.  Don't add a
> vertical scroll bar, so the user won't be tempted to make more than
eight.  Let
> them enter their eight values.  Go to DB2 and create your value list
based on the
> field Value in DB3, you don't even have to relate them.

> You will have to delete the eight records in DB3 at the end of each
session, but
> you can use an external script to do that and call it from your Close
script in
> DB1.

> What do you think?

> Best of Luck -
> James

Hi James

suggestion from Redwing)  but I do appreciate the time and effort that you
went to.

In the end, the solution wasn't as hard as I thought - my biggest problem
was that it required a function I had never had to use before and
therefore was not familiar with.  I have outlined the solution in my reply
to Redwing if you are interested.

Thanks again James!

--
Bridget Eley

Tue, 17 Dec 2002 03:00:00 GMT

 Page 1 of 1 [ 8 post ]

Relevant Pages