Solved

Getting the name of a field?

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

19 Experts available now in Live!

Get 1:1 Help Now