Jump to content

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

Recommended Posts

Posted

I am trying to understand how to take advantage of global calculation repetitions.

If I have a global text field with 5 reps and it contains data; and I want to use a global calculation with 5 repetitions; and I want to control whether the calc's repetitions display the matching data in the corresponding global text rep, can this be done?

Example:

Global text contains:

Rep1 - Contact Buyer

Rep2 - Prepare Quote

Rep3 - Schedule Interview

I want the global calculation reps to display this data, depending upon a calculation, such as:

If NoContact = "Yes", calc's Rep1 should display Contact Buyer (global Rep1)

If Permission = "Yes", calc's Rep2 should display Prepare Quote (global Rep2)

I want to define one calculation on the global calculation repetition field which will display the results in its reps, depending upon the calc but use the data from the global text. Is this making sense? This is for Developer use to display information and will not contain User data.

I guess I don't understand how to take advantage of global calculation repetitions. I tried using Extend and GetRepetition ( repeatingField ; number ) but can't seem to put this together.

... or ... Can I use Auto-Enter on the global text (Replace) via calculation which will change the data in each repetition based upon the above calculation? Example:

If NoContact = "Yes", Rep1 should display "Contact Buyer"

If Permission = "Yes", Rep2 should display "Prepare Quote"

As you can see, reps are not my strong area. I can not script this - it must be automatic to be useful. smirk.gif

LaRetta

Posted

I realize I'm mixing apples and oranges here (my usual style). When I hear the phrase, "Globals APPLY to all records," what does that mean in terms of a global calculation? That it DISPLAYS the same for all records, or that it calculates based upon all records (?). The thought of a global calculation leaves me a bit perplexed because calculations *normally* apply to a record.

Anyway, for this solution, I would be willing to use a standard text field (with reps) with Auto-Enter (Replace) instead; or use a regular calculation (with reps) instead if necessary to address a specific record.

What matters is that the calculation be based upon the current record (being displayed on a form layout). And I need to apply the calculation differently in each repetition. Possible? Or do I need a very long vacation? smirk.gif

LaRetta

Posted

Hi,

I'd imagine you'd like one of those reps to be filled and the other empties.

If so, you could use 3 sets of globals reps with

gSet1 = Contact Buyer |Empty | Empty |

gSet2 = Empty | Prepare Quote | Empty |

gSet3 = Empty | Empty | Schedule Interview |

Then your cRepCalc could be something along these lines :o

Case(Extend(NoContact) = "Yes", gSet1,Case(Extend(Permission) = "Yes",gSet2,gSet3),gSet3)

You could also investigate the lookup way....which may be more dynamic and indexable. And of course this is limied to my FM6 knowledge...

HTH

Posted

It appears to display the same data for all records, as in previous versions. It calculated the value based on the record I was on when I created the field and didn't change until I modified a referenced field in any one of the records. I think this would only be highly useful for carrying a calculated value through a found set in a script without having to set a global with specific data, sort of an automatic global, if you will.

Posted

Hi Ugo!! Hi JT!!! Thanks for the help guys. The idea is to NOT have to use multiple fields - which is why I wanted to use reps. And I don't even care if it displays the same thing for all records - because, if it was based upon the current record, ie, when User is on form layout (and it uses the current record data), it will accomplish what I wish because that is all the User will see.

Hmmm, well - since I have you two - and you both have played with repetitions (quite extensively for calculation work), can a regular text repetition field be used? Since the results will depend upon record data-change, the new Auto-Enter (Replace) via calculation should work on a repetition field, shouldn't it? I can't get Auto-Enter on reps to work - but I'm a ninny on repetitions so I don't know if it's my ignorance or just not possible. I've only used regular calculation to display various global reps, etc. In < 7, have you been able to control the contents of reps, ie, a calculation with reps? If so, Auto-Enter should work in 7 to modify the rep contents as well.

Lookups, Ugo? I'm willing to try anything. Could you both feed me more information? I'm willing to do the homework but need a push-start, I'm afraid. If this is a pipe-dream, I will resign the idea ... but not without a good fight first. You see, the added ability in 7 to select the rep # to display as been driving me insane with possibilties - but only if we can also control the calculated rep content. What good are calculation repetitions if they will not change depending upon a calculation?

God Lee!! I love the new icons too! Thanks, Stephen. applause.gif

LaRetta

Posted

Well, it displays the same thing for all records, but you have to change a referenced calculation field in order for it to use *this* record's data. You can set reps with different content based on calculations. In fact, I posted about this on Mark Jeffords' forum a couple of weeks ago, on how to use repeating calcs to create a spreadsheet type report that is the same for all records. I can find the link if you like.

I don't see why a non-global repeating calculation wouldn't work just as well for you, as it would automatically change based on the current record's data.

I haven't dowloaded Ugo's file yet. But I'm sure it's spiffy. wink.gif

Posted

I will play with these ideas and the demo when I get home tonight. Thank you Ugo for providing this for me.

Queue said... don't see why a non-global repeating calculation wouldn't work just as well for you, as it would automatically change based on the current record's data.

Okay! One repeating calculation with 5 reps would be wonderful. I want the calculation to be as I indicated in my first post, ie:

Case(NoContact = "Yes"; Rep1 = "Contact Buyer" ; Permission = "Yes", Rep2 = "Prepare Quote" ... and so on. In other words, each rep would be a toggle of the data I specify - display the data or display nothing (per repetition). If this is possible, then I can use the SAME FIELD to hold multiple displayed results by specifying the rep # to display in field format. In the past, we have had to create a different calculation for conditional data displays because we couldn't place the SAME calculation in two places - it would display the same results in both places. BUT ... if this can be controlled instead within the calculation, we can place Rep1 in one location, Rep2 in another and so forth. We can use the same field. Am I the only one that sees possibilities here?

And if a regular calculation would work - so would Auto-Enter (Replace)!? It's probably so easy for you two, that you think I'm asking something complex. laugh.gif But it's probably only complex for me because I've never succeeded in doing it. I'll settle for a regular calculation with reps!!! YES - I want to see your post on it Queue, please.

Please forgive my struggle in trying to explain this. But being able to copy/paste the same (repetition) field and simply change the rep number to display instead of having multiple calculation fields is powerful. If at ALL possible, I want to figure out how.

LaRetta

Posted

Choose( Get(CalculationRepetitionNumber) - 1; Case( Extend(NoContact) = "Yes"; "Contact Buyer" ); Case( Extend(Permission) = "Yes"; "Prepare Quote" ) )

I'm not sure how it would work as an auto-enter calc, but you could test it.

And here's the link. Note that the reps field wouldn't be needed as you now have Get(CalculationRepetitionNumber) to do the job.

Posted

Thanks so much for the calculation Queue!!!! Well, attached is the reason I was excited. Dan Brill got me re-thinking about the issue of placing field labels in the fields. But I have hated the idea of all the calculations (or relationships) and work required to pull it off. Field labels are distracting and clutter a layout - no matter how small you make them. This provides a very clean looking interface.

FM7 now allows us to specify individual labels/backgrounds for fields all based upon other unstored calculations - and all with only one calc. laugh.gif

LaRetta

FieldFactory.zip

Posted

Here is a more dynamic example. The field Names is used to hold the desired fields to test for the current layout. It would, of course, require a different field for each layout or a different repetition containing each layout's fields in desired order. It parses through the Names field using MiddleValues. If the current repetition is empty, then it tests whether there is a Field Comment and uses that; if there is no Field Comment, the field name itself is used. This allows you to hard-code the field names in Names and hard-code the label to be used if the field name itself is not satisfactory, but does not require hard-coding the labels into the calculation. Therefore, it's completely dynamic. Change the order of field names in Names and the results update automatically. You can delete a field from the layout and simply delete the name from the Names field, without tweaking the calc.

I'm quite stymied that my resulting calc will not visually update past the first repetition, unless the repetitions are directly over their 'related' fields. You will see what I mean when you get into the attachment. I recreated the Display field, in case it was due to FM's table of dependencies. But it appears that the exact same calculated field duplicated and moved completely off the data entry text field simply refuses to update.

Can you make anything of this?

FieldLabels.zip

Posted

Okay, I figured out the problem, but I still don't know why it worked when the labels were stacked.

The attached modified file specifies the fields for Evaluate to track. When one of them changes, the calculation updates. Unfortunately, it doesn't seem like you can calculate the list of fields to include; FM requires one or more field names and not an expression that results in one or more. So that part is hard-coded; but I think you would only need to change it if adding a field to the list.

Actually, it just hit me to use a mod time field for the Evaluate parameter. So it will update whenever the record is modified. Duh!

I haven't tried a custom function yet. I'll work on that now.

FieldLabels.zip

Posted

I am still playing with this process. There is one minor problem I see. If you delete a field from this repetition calculation, the remaining 'labels' move up. This will throw all your subsequent labels off. To remedy this, I suggest you leave all lines instead of deleting any. Simply change the line to display "". You can re-use that rep for other labels. Order doesn't matter - only what rep number you specify when you place it on top of a field. The calc (example) is:

Choose(Get(CalculationRepetitionNumber) - 1;

Case(Extend(First) = ""; "First Name");

Case(Extend(Middle) = ""; "Middle Name");

Case(Extend(Last) = ""; "Last Name");

Case(Extend(Phone) = ""; ""):( .... when later Management decides not to display label

In this way, the label won't display but it will preserve that repeating field placement. Otherwise, you will need to respecify all subsequent rep numbers by selecting EACH rep field and pointing to the new rep number to display. I see this as a minor issue and overall the process is great, compared to creating a new calc for every field.

LaRetta

Posted

Hi,

May I ask a screenshot of a layout using this technique. Without 7 running, I cannot find a way to figure what it does.

It seems you're using it for vertical labels in a table. Is that it ?

If not, I can't see how this can be used in horizontal layers with variable columns.

Posted

Hi Ugo smile.gif

"horizontal layers with variable columns"

This replaces the multiple calculations normally required - one for EACH placement of a field label (conditional display). It just uses reps to store each label. And, since in 7 we can now specify which rep will display (only one even), we can just copy the same repetition calculation over and over - and simply change the rep number to display it's corresponding field label. Very quick!

No problem. Here's the idea of it (and I'm also attaching the doc file which explains it better). It would be easy to reproduce in < 7 but you wouldn't be able to take advantage of specifying which reps to display so wouldn't work in the field labels idea - same with portals now - very cool!!!!

If you notice bottom right I display one column and also two columns. This is simply controlled by placing the same calculation twice (just like in the label idea) and controlling it through field format (start at rep, show number of reps). I've been going crazy playing with these new features. It tickles me that, as each field is filled in, the field names disappears from the bottom right columns too. Of course, just about everything FM tickles me, so it's not surprising. smile.gif

LaRetta

FieldFactory.zip

Posted

Ok, got it, thanks for your time. Very interresting indeed.

Just one thing.

It would be easy to reproduce in < 7 but you wouldn't be able to take advantage of specifying which reps to display so wouldn't work in the field labels idea

It would work but you'd need an external file for this. Done it a few times already. Time consuming.

External file with these fields :(

a serial (num)

filename (txt)

layoutname (txt)

labels_rep (txt)

labelkey (a compound of FileName and LayoutNumber)

The whole stuff can be scripted with a loop which updates the external file, any time a field is added.

At the end, you'd simply look up the rep from the related file, using a key of type FileName& "_"&LayoutNumber (matching labelkey) as a trigger as soon as you switch to a new layout.

It would be tedious to have the color trick workee though.

Posted

Oh that does indeed sound tedious. With 7, one calculation, no relationships and no scripts! yep.gif

I should also mention to everyone that I attached an fp5 file but it only contains a copy/paste of the screen. I flashed on people not knowing, and looking in Define Fields - nothing; Scripts - nothing; Relationships - nothing; Value Lists - nothing; and Custom Functions - nothing!!?? shocked.gif

Wow!! This lady's good! I hate to admit that I've found myself clicking windows buttons on a screen shot and cussing because the darned thing wouldn't minimize. blush.gif

The demo's are attached up above, folks!

LaRetta

Posted

Yes it is simple for sure with 7, although you'd have to modify the calc anytime you add fieldLabels.

Thanks again for the screenshot, waiting for my frenc Dev7 to be shipped.

Posted

"although you'd have to modify the calc anytime you add fieldLabels."

And you don't with any other process? That's true with everything we do, isn't it? Our line of work IS in layout mode after all. smile.gif Any time you add a field in Define Fields, or decide to place a new field on a form, it is no different. But it is simpler to just add a line to the calc (or drop the new field onto a Developer layout). Then just copy the existing calc rep, place it over your new field and change it to rep11. Done.

Posted

Hi,

If I can dig my hardrive tonight, I may post a sampler which I did some time ago, which only required an update script.

But don't take me wrong, I'm convinced yours is more dynamic, and of course adapted to where 7 is leading us.

If only I could try it to really understand how you planned to make it work, caue shame on me, I'd like your buttons on screenshot to be active. smile.gif

Posted

Hi Ugo, Queue!

Well, I posted it in Sample Files. I have included field background highlights - each field independent of the others - each field changing according to other criteria or calculations. And all with only one calculation container that is copy/pasted under every field. I stayed with my original idea (instead of Queue's) for now, because it was simpler for new people; and it didn't require script for New Record Creation. Plus Queue's method (although more dynamic) required a new calculation for every layout. Anyone can do this. Just copy the same calc field, change the field to the associated rep number and place it. Add your evaluation conditions in one calc as a new line and you're done. God, I love this business. smile.gif

This picture is only for you Ugo, cus you can't open the demo. This gif changed the color of the original file and doesn't show FirstName and LastName in it's highlighted yellow state. The real demo file does though.

fieldfactory.gif

  • 2 weeks later...
Posted

Hi John,

Yes, it works very well in portals. I use it in an address portal. Just place your calculation in the portal table. And be sure to unclick 'Do not evaluate if all referenced fields are empty.' smile.gif

LaRetta

This topic is 7491 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.