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

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

Recommended Posts

Posted

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

Posted

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

Posted (edited)

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
Posted

It seems like a good workaround.

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

Posted

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

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