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.

Value list of active employee only

Featured Replies

Hi,

Here's the picture, I have a database with a table invoice and a table employee.

Each invoice is related to an employee who created it. 1-to-many relationship.

Invoice (pkInvoiceID, ..., fkEmployeeID)

Employee (pkEmployeeID, ..., isActive)

Some employees don't work anymore for the store, there's a field named isActive which is a boolean (number).

In the invoice layout, I'm trying to make a value list with only the active employee, but without success.

Is there a way to do value list which represent this query "Select * from Employe where isActive=true"?

Thank you

If you create a calc of 1 and you use in a join to a new TO for your Employee table then you should be able to get this filtered value list. The relationship should be keyed:

cOne = isActive

I would be inclined to have a field in Employee called ActiveID which would be Auto-Enter (Replace) of:

Case ( IsActive ; EmployeeID )

Or just use a calculation ( but don't make it unstored) ... and then basing a new value list called Active Employees on that instead. It's just another perspective and not necessarily a better technique ...

LaRetta :wink2:

Edited by Guest
Changed a sentence

  • Author

It seems like a good workaround.

Is there a way to do a SQL query in FM?

Of course a value list and search are not the same thing. A value list cannot be based upon a found set of records. So I'm a bit confused on why you want to query (find) in FM. It would really help if you provided the context and purpose. If you want a drop-down field to display active employees (so it would be based upon field values) then you must use a relationship. If you want to just find active Employees in the Employee table, you would perform a Find script similar to:

Go to Layout [ layout based upon Employee table ]

Set Error Capture [ On ]

Perform Find [ no dialog ; Find Criteria: isActive (and then type just the value in that field*)

If [ not Get ( FoundCount ) ]

Show Custom Dialog [ OK ; "No active Employees. Ha haha!" ]

Show All Records

Halt Script

End If

... now you have your found set of active Employees

* according to your background and the fact that you typed 'true' in the IsActive field, I will assume that you understand boolean and the value in the field is probably a 1. If so, type just a 1 as the criteria in the stored find. If you have actually inserted the words 'true' then type true.

But again, you are mixing sugar and salt here and value lists and searches just don't go together. :wink2:

LaRetta

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.