Solved

Getting the name of a field?

Posted on 1997-10-12
3
139 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now