Jump to content

This topic is 7922 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Yes.

When a formula is defined for a calculation field that has repetitions, the result the formula produces may be different for each repetition - because by default the input values are taken from corresponding repetitions in referenced fields. This can be controlled by the use of the Extend( ) and GetRepetition( ) functions. In this instance the result will nevertheless represent alternative iterations and inputs of the same basic construct.

But if you want a completely different formula to be applied for each repetition, you can achieve that with the use of a reference field. Thus for example, if you have a reference field (gRef_txt) that is defined as a global text field with three repetitions, and you enter 'Profit', 'Loss', and 'Capital Gain' into the three repetitions respectively, you will then be able to set up your calc field with three repetitions and contrive to have a different formulae applied to each repetition by defining its formula along the lines of:

Case(

gRef_txt = "Profit", your profit formula here,

gRef_txt = "Loss", your loss formula here,

gRef_txt = "Capital Gain", your capital gain formula here

)

However your three formulae will have to be constructed so as to maintain their referential integrity according to the repetition in which they calculate, so again, you will need to make careful and appropriate use of functions like Extend( ), Last( ) and GetRepetition( ) in order to fully control the way in which source values from elsewhere in the database are rendered. wink.gif

Posted

Thanks Ray,

my problem is however a little different from the one you listed above. And that is the following:

I have a dbase, which actually contains the records of two different databases (files), dbase A and B (I am working on it right now, although not quite sure how I'm gonna get it working crazy.gif -- see the "relationships" thread). So the three calculations I would like to place in one repeating field are:

rep. 1 -- calculate the total records of the final dbase (Record x of n) (Status(CurrentRecordNumber) & " of " & Status(CurrentFoundCount))

rep. 2 --- calculate the total records of dbase A (thus one of the two databases -- the same format Record type A x of n)

rep. 3 --- the same for dbase B.

I should get a different value in two fields at the same time:

so Record x of n (always) and | Product type A x of n | or Product type B x of n|

Do I expect too much from FM?

Posted

The details may be different, but the principle is not.

Once you have established what the three formulae you will be using are (which will be dependent on the structural approach you choose) you will be able to establish a reference field and drop the formulae into a case statement along the lines of the example I provided above and your three results will then appear in successive repetitions.

This topic is 7922 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.