Solved

Getting the name of a field?

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best Firemonkey component pack 1 104
Communication Between RC4 Delphi <-> PHP 3 113
RESTRequest Parameter 4 30
firemonkey keyboard covers the controls 1 25
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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