Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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

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

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