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

Featured Replies

  • Newbies

Hello,

 

In a table called "ITEMS" I have a field called "ItemCode".  Beside it is a portal that references a related table called "ORDERS".  It shows the OrderYear and QtyProduced fields for every record in the "ORDERS" table that has the same ItemCode as the record being browsed.  The ItemsCode field is what links the "ITEMS" and the "ORDERS" tables together.

 

I have been able to get a summary of the total QtyProduced for all the records in the "ORDERS" table that have the same ItemCode as the record I am browsing, regardless of the year.  For this, the formula I am using is " =Sum(Orders::QtyProduced) ". and it is working.

 

But I'd like to break it out by year as well.  My formula for this is " =if(Orders::OrderYear="2011",sum(Orders::QtyProduced);0) ".  But it is returning a qty of 0 even though there are definitely records of this item being made in 2011.

 

Any ideas what I am doing wrong?  The OrderYear field in the "ORDERS" table is a calculation that is pulling just the year from a date field called "OrderDate".

 

Thanks very much,

:) Sara

First, here's why that didn't work. Your formula is in the items file. It looks at the related orders and gets the FIRST related record (the first one that was created, unless your relationship is sorted). Is OrderYear 2011 in that first record? If not, you get zero.

 

Are you wanting one year at a time, or will you display multiple years? Is this going to be in a table or list view, or one item at a time? The answers to these questions might affect the approach you take, since these type of calculations can be slow, depending on the number of related records.

 

You might want to do this using ExecuteSQL, e.g. (off the top of my head -- not tested):

ExecuteSQL( "SELECT sum( QtyProduced ) FROM Orders WHERE OrderYear = ?" ; "" ; "" ; 2011 )

Create an account or sign in to comment

Important Information

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

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.