Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Max Text field

Featured Replies

Hiya,

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

EG

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!

Regards,

Kerrin smile.gif

  • Author

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:

max(SelfRelatedbyInvoiceNo::Qty)

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.

MaxProd::Product

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

Regards,

Kerrin

  • 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.

  • Author

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

Akart

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.