Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting the name of a field?

Posted on 1997-10-12
3
Medium Priority
?
155 Views
Last Modified: 2010-04-04
I am programmatically searching a dataset for a particular value using the locate function. what i need to know is how can i get the name of the field when the function successfully locates this value?(i use delphi 3)
0
Comment
Question by:naickers2
3 Comments
 

Accepted Solution

by:
crexes earned 100 total points
ID: 1347376
Hi...
The following example uses the "locate" - function and locates the value '10' in your table.
After that you can use the "fieldbyname" - procedure to get the value from the current position in the table.
I hope that this is what you wanted...
.
.
var SearchOptions : TLocateOptions;
    SearchKey, ValueThatIWant : integer;
.
.
  SearchKey := 10;
  TableName.Locate('FieldNameToSearchIn',SearchKey,                     SearchOptions);
  ValueThatIWant :=
  TableName.FieldByName('FieldNameThatYouWant').Value;
.
.
 


0
 

Author Comment

by:naickers2
ID: 1347377
This is not exactly what i wanted - forgive my vague question - this is the scenario - If i know the name of a table and need to see if it has a certain value in it and use the findnearest function which does not require any fieldnames to look in, if the search is successful, i need to extract the name of the field in which the value was found. I HAVE NO IDEA OR CLUE AS TO THE NAMES OF THE FIELDS IN THE TABLE. How do i do this?
0
 

Expert Comment

by:krisz
ID: 1347378
FindNearest searches only in the key fields, and search values specified in the correct order.

It won't search in the whole table.

You misunderstood something.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question