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 with added string

Featured Replies

Trying to add some text to a query.

 

For example here's a real simple calculation with a query that returns some text

ExecuteSQL(
"SELECT n_transactionAmountGross,  t_transactionModel
FROM Transactions  
WHERE  FamilyID_CustomerID = ?"   ;    " : "   ;   ""     ;   FamilyID )
)
 
For a particular record it could return something like
 
100 : Membership 
200 : Lesson
 
I'd like to show the amount as currency. 
 
Even though the amount is a number in Filemaker, I assume that since the calculation is returning text the amounts are now a text string.  So i'd like to prepend a dollar sign. But any number of operations like   "$" +     or   Quote like used in the following don't work. I've tried it as a parameter using a variable as well.
ExecuteSQL ( 
"SELECT " & Quote("$") & "n_transactionAmountGross,  t_transactionModel
FROM Transactions  
WHERE  FamilyID_CustomerID = ?"   ;    " : "   ;   ""     ;   FamilyID )
)
 
Anyone have a solution for inserting text into a query?
 
---------
BTW: Even if I was only returning the amount, and switched the calculation to return a number I cannot CAST the number as smallmoney which might be a solution.  I guess ultimately whatever data the calculation returns will override the datatype returned by SQL.

Solved by eos

Go to solution
  • Solution

There are different syntaxes; I found that the one from Oracle works in FM (see screenshot). Put the string in single quotes.

ExecuteSQL
( "
  SELECT '$' || n_transactionAmountGross,  t_transactionModel
  FROM Transactions  
  WHERE  FamilyID_CustomerID = ?

  "   ;    " : "   ;   ""     ;   FamilyID
)

post-80889-0-02124600-1376300516_thumb.p

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.