richy240
Registered User.
- Local time
- Today, 13:59
- Joined
- Oct 23, 2003
- Messages
- 16
I am exploring the possibility of storing a key value in multiple fields, but presenting it to the user as one single value. The reason for this is that the information used as the primary key contains the value of a foreign key field plus some additional data. I would like to limit the number of times this data is listed in the table.
The table structure is as follows:
- po_SAP_num (primary key; relates to foreign table)
- ncr_num (primary key)
- supplier_SAP_num
- agency_id
- date_opened
- date_closed
The format for po_SAP_num is 10 digits, starting with '51' (ex. 51000012345). The format for ncr_num is based on the po_SAP_num field. It adds 'NCR' to the beginning of po_SAP_num, a dash, and a three digit code. This three digit code is actually the unique piece of data here. It increments every time there is a new record for that po_SAP_num (ex. NCR5100012345-001, ...002, ...003, etc.).
So, I want to display the 'NCR...' number to the user as NCR5100012345-001, but store it in two different fields: po_SAP_num and another field, maybe ncr_num; one containing a number (that can be altered and displayed as a three digit number, padded with zeros).
I face a few problems here:
- When the user inputs po_SAP_num, I must (using code) count the number of records in the DB with po_SAP_num, then build a string that has 'NCR', the value of po_SAP_num and the next available report number padded it with zeros on the right side. I must also present this to the user before the data input form is closed.
- When the user wants to run a report, I want him/her to input the whole string (ex. NCR5100012345-001) as the criteria. Then I must (again, using code) dismantle this critera into usable data (two values in this case) in order to run the report.
This is a large and complicated undertaking, I think. Right now I am just looking for help with the logic behind this problem. After that, I think I might be able to implement this without too many hicups (I hope).
So, my questions are:
- Is this even a good idea?
- Would it be more work than it is worth?
- Would this either speed up or slow down my application (to the point where it is noticable)?
- Am I crazy for even thinking this?
Thanks in advance! Anyone who would touch this one is truely a helpful individual!
The table structure is as follows:
- po_SAP_num (primary key; relates to foreign table)
- ncr_num (primary key)
- supplier_SAP_num
- agency_id
- date_opened
- date_closed
The format for po_SAP_num is 10 digits, starting with '51' (ex. 51000012345). The format for ncr_num is based on the po_SAP_num field. It adds 'NCR' to the beginning of po_SAP_num, a dash, and a three digit code. This three digit code is actually the unique piece of data here. It increments every time there is a new record for that po_SAP_num (ex. NCR5100012345-001, ...002, ...003, etc.).
So, I want to display the 'NCR...' number to the user as NCR5100012345-001, but store it in two different fields: po_SAP_num and another field, maybe ncr_num; one containing a number (that can be altered and displayed as a three digit number, padded with zeros).
I face a few problems here:
- When the user inputs po_SAP_num, I must (using code) count the number of records in the DB with po_SAP_num, then build a string that has 'NCR', the value of po_SAP_num and the next available report number padded it with zeros on the right side. I must also present this to the user before the data input form is closed.
- When the user wants to run a report, I want him/her to input the whole string (ex. NCR5100012345-001) as the criteria. Then I must (again, using code) dismantle this critera into usable data (two values in this case) in order to run the report.
This is a large and complicated undertaking, I think. Right now I am just looking for help with the logic behind this problem. After that, I think I might be able to implement this without too many hicups (I hope).
So, my questions are:
- Is this even a good idea?
- Would it be more work than it is worth?
- Would this either speed up or slow down my application (to the point where it is noticable)?
- Am I crazy for even thinking this?
Thanks in advance! Anyone who would touch this one is truely a helpful individual!