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.

ExecuteSQL Relationship Issue?

Featured Replies

  • Newbies

I need some help with ExecuteSQL.

I have a TO “Sales” that is related to Estimates, Inspections, and Proposals via ID_SALES:id_sales.

I created some simple ExecuteSQL calculations that work on Estimates and Inspections, but the same calculations will not work with the related Proposals TO. 

·         I know that the relationship is good because I can get the SUM and COUNT from Proposals with a basic calculation (not ExecuteSQL).

·         I know there is not a problem with the name on the related Proposals TO (like a space between words). I've copied and pasted the working calculations and I have started from scratch, and neither works.

This statement works:

ExecuteSQL ( "SELECT COUNT

(ID_ESTIMATES) FROM TO40_ESTIMATES

WHERE ID_SALES = ? “ ;

"" ; "" ;

TO13_sales_ESTIMATES||id_sales::id_sales )

---

This statement does not work:

ExecuteSQL ( " SELECT COUNT

(ID_PROPOSAL) FROM TO26_PROPOSALS

WHERE ID_SALES = ? ";

 "" ; "" ;

TO13_sales_PROPOSALS||id_sales::id_sales)

 

Any help would be appreciated.

SC

The fact that the relationships work on the FMS side is completely irrelevant once you use ExecuteSQL().  The SQL query does not use nor honor the FM relationships.  Which is a good thing because it gives all the flexibility.

When you say "this statement does not work", what is the result?  If the result is "?" then you have a syntax error in your query.  If the result is empty or a number that you don't expect then the query does something else than you expect.  Possibly because the context where you are on (the layout) when you run the query has no access to this field: TO13_sales_PROPOSALS||id_sales::id_sales

 

 

  • Author
  • Newbies

Thanks to both of you for that information.  After reading the referenced information and using Daniel Woods' custom function, I renamed the TO for Proposals and the statement worked.

Create an account or sign in to comment

Similar Content

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.