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.

Is WHERE RECORD = ? possible

Featured Replies

Is the following query possible? If yes, what is missing from my format. If not, what are my alternatives to a achieve the same goal?

ExecuteSQL ("SELECT Name FROM Customerdb WHERE ROW = 1"; ""; ""; "")

or

ExecuteSQL ("SELECT Name FROM Cutomerdb WHERE RECORD = 1"; ""; ""; "")

 

Thanks in advance.

Edited by Joshua

What exactly are you trying to do?

  • Author

Thank you for your response. On a particular script that I'm working on... I need to pull certain information one record at a time. Because some of the records will have the field blank the work around seems inefficient especially when I have to repeat it several times in different parts of the script:

 

Set Variable [$CustomerIDs; Value:ExecuteSQL ("SELECT CustomerIDs FROM Customerdb"; ""; ""; "")]

Set Variable [$CustomerID; Value:GetValue ($CustomerIDs; MainPage::RecordNum)]

Set Variable [$CustomerName; Value: ExecuteSQL ("SELECT Name FROM Customerdb WHERE CustomerID = ?"; ""; ""; $CustomerID)]

 

What I was wondering is it possible to do the following:

Set Variable [$CustomerName; Value: ExecuteSQL ("SELECT Name FROM Customerdb WHERE ROW = ?"; ""; ""; MainPage::RecordNum)]

 

 

On a particular script that I'm working on... I need to pull certain information one record at a time.

Gee … now everything is clear. ;)

Set Variable [$CustomerName; Value: ExecuteSQL ("SELECT Name FROM Customerdb WHERE ROW = ?"; ""; ""; MainPage::RecordNum)]

What you mean is probably along the lines of

ExecuteSQL ( "
  SELECT Name
  FROM Customerdb 
  OFFSET " & Get (RecordNumber ) /* MainPage::RecordNum ? */ - 1 & " ROWS
  FETCH FIRST 1 ROW ONLY 
  " ; "" ; ""
)

OTOH, why not use

Set Variable ( $listOfCustomerNames ;  ExecuteSQL ( " SELECT Name FROM Customerdb " ; "" ; "" ) 
# [ or, if in context: List ( Customerdb::Name ) ]
Set Variable [ $currentCustomerName ; GetValue ( $listOfCustomerNames ; Get ( RecordNumber ) ) ] 

Hard to tell what you need without knowing any details.

eos has presented two very viable options!

@Joshua the ExecuteSQL function in FM is not 'full-featured'. You cannot use all the available SQL functions that you might find in MySQL or MS SQL or Oracle or ....

In case you haven't seen this, it might help you see what you can/cannot do with ExecuteSQL:

http://filemakerhacks.com/2012/10/19/the-missing-fm-12-executesql-reference/

The blog article was just a start. I recommend that you get the PDF and the sample files.

beverly

  • Author

Ok, thank you.

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.