Jump to content

Max Text field

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

Recommended Posts


I am trying to create a calculated field that will return a Text value from a related record based on the highest quantity.


I have 3 fields Product, Qty and Price for two records as follows:

Cake 1 $10

Sugar 2 $5

If i do max(SelfRelatedbyInvoiceNo::Qty) in my field definition then each record will display a 2

But how would i display the word sugar instead?

Any help would be fantastic!


Kerrin smile.gif

Link to comment
Share on other sites

Ok, so i fixed it, but for anyone that was curious this is what i did:

I created a calc field name cMaxQty as follows:


Then i made a relationship(called MaxProd) From cMaxQty to SelfRelatedbyInvoiceNo::Qty

Finally i can put the related Product field on my form to display the product name or create another calc field like this.


This works but if anyone can suggest better "programming practice" grin.gif I would appreciate it.



Link to comment
Share on other sites

  • Newbies

Cool solution kerrin! smile.gif

I have done something a bit like this, but simply used a calculating constant field on both sides of the relationship. Then I specified to sort in descending order by the quantity.

If I use QuantitySort::Product I get the product with the highest quantity, but I can use the same relationship to place a portal on another layout with products listed in descending order by quantity. Plus I also use the same constant calc for several other relationships.

The outcome is the same as with your method, though.

Link to comment
Share on other sites

So simple yet ingenious.

I skinned my cat again.

My records already had the same invoice number so i made a relationship, sorted by qty descending.

Works great and now i can get rid of those extra field definitions....

Thanks wink.gif


Link to comment
Share on other sites

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