?
Solved

Problem with Record Pointer!!

Posted on 1998-05-12
7
Medium Priority
?
219 Views
Last Modified: 2010-04-06
Hi,
I am new in delphi and working in Delphi 3.0 with local database (PARADOX) I just want to tell you about the structure of tables ....I have three tables actually...like

**PRODUCTS**
ProductCode   Alpha   4          *  <---(its my Key Field)
Description      Alpha   30
Qty_onhand     Integer

** Master_Table **
ProductCode   Alpha  4    *  (Key Field)
MDate              Date

** Detail_Table **
ProductCode    Alpha  4    * (Key Field)
Description       <-----(its my Lookup field in Detail Grid and picked from Products Table)
Qtytoproduced  Integer

So as you can see Products is my Lookup Table...and the problem is in TDBGrid when I Insert
Record and give a Product Code it automatically Pick the Description from Products Table and then I give
Qtytoproduced and this Quantity I want to add in Products Table...But I think that After Picking-up the Description
from Products table Pointer has to be located at the position of given valid Product Code But it always at the First Record in Products Table and thats Why I am feeling a trouble to add the QtytoProduced in the Products Table Coz if the Record Pointer is not automatically located there then Its hard for me to writing the long code for addition of those Quantities in Products Table....
So please kindly repyl me if anybody can answer my question Coz I am working on a project and time is the only matter for me ...

thanks
Zahid
0
Comment
Question by:zahzia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 

Expert Comment

by:yduke
ID: 1345097
Hi Zahid,

Although in your description of your problem you were not very clear on the table names, from what I understand a solution for you is to use SQL statement to locate the appropriate record and point the pointer where you want.  

After you insert the product code and you perform a lookup to get the description from products table, write an SQL statement for the Detail_Table using the product code value stored in your form's edit.box for product code.  Then set as parameters in your SQL statement the Qtytoproduce field and store it in a hidden edit box.  Then just write a line of PASCAL code adding that variable with the Qtytoproduce.box (the entered value in the form) and then call the update function to update the table.  Make sure that you have "cash updates" enabled on the tables parameters, and also that you open and close the tables every time you use them(using the functions, open/close/update etc).

good luck

0
 

Author Comment

by:zahzia
ID: 1345098
Actually you misunderstand my Question I just want to know that in LOOKUP field is this true that record pointer has to be located at the position in the lookup table of the searching code or not ? Or one has to be located that pointer explicitly ...??
thats it...

0
 
LVL 1

Expert Comment

by:michaue
ID: 1345099
Am I right in assuming that you want to move Qtytoproduced from the Detail Table to the Qty_onhand field in the Products Table, where the Product Code from the Detail Table match up with the correct record to update in the Products table (where the Product codes is the same)?

And am I correct in assuming that when you want to update the Products table the record pointer is at the first record, therefor your update isn't correct?

If this is the case, I will be able to answer your question.
0
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.

 

Author Comment

by:zahzia
ID: 1345100
Yes now you got my question correctly....this is the problems I am facing right now...
In my product table there are three products records actually..Like

ProductCode  Description      Qty_onhand
0001              ABC product       100
0002              DEF product        200
0003              GHI  product        300

So in detail table GRID let suppose I give 0002 and then it picks the description
'DEF product' from the PRODUCTS table and then I want to add 450 in the previous balance of products table which is 200 ....but then after posting the record it always add that 450 at the first record of the products table which is 0001 ABC product and it adds the 450 into 100 which is the balance of 0001 product....so thats my problem...
Why the pointer of PRODUCT table is still on first record ...but strange thing is the lookup is perfect but after successful lookup it leaves the pointer at the begining...
So now what would you like to say....

thanks

0
 
LVL 1

Accepted Solution

by:
michaue earned 80 total points
ID: 1345101
You can move to a specific record in the PRODUCTS table by using the following command. You can set its paramaters to do many different things.  Have a look in help if you want to know more ...  The basic idea is the following :

if PRODUCTS.locate('PRODUCTCODE','0002',[]) = true then
  <Update the record>

The locate method will position the counter on the field. You can find more help on it under TBDEDataSet.Locate.
0
 

Author Comment

by:zahzia
ID: 1345102
My question is still in middle coz i just want to know that in my situatuion pointer has to be move or not thats it ?
and I solved my problem already to move my record position throuch locate but I just want to ask that its normal or not ?

0
 
LVL 1

Expert Comment

by:michaue
ID: 1345103
No as far as I have experienced the record pointer doesn't move when you do a lookup on a table like that, because in most transactions when a lookup table is referenced thats all that happens, and the lookup table isn't updated in the same procedure step.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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