Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Complex Product Code
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Complex Product Code
Hi,
I'm trying to build a warehouse aplication. One product is identified by two codes from diferente tables:
Example: 00123 345
00123 is the palet number
345 is a unit in the palet
How can I do this using the auto increment?
Thank You!
Best Regards,
Rui
I'm trying to build a warehouse aplication. One product is identified by two codes from diferente tables:
Example: 00123 345
00123 is the palet number
345 is a unit in the palet
How can I do this using the auto increment?
Thank You!
Best Regards,
Rui
BR
Rui
Rui
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Complex Product Code
Rui,
The simple answer is don't use auto-increment.
Why do you want to?
Steven
The simple answer is don't use auto-increment.
Why do you want to?
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Complex Product Code
Hi Steven,
If I don't use auto-increment.
How can I do this?
In the image attached I send you one example:
1 - Wharehouse code
10 - Customer Code
0000101 - Pallet code
122 - Unit code (unit that is in the pallet )
So for diferent wharehouses I can have the same pallet number and unit number.
But the Job Number it is always diferent.
Any ideia?
Regards,
Rui
If I don't use auto-increment.
How can I do this?
In the image attached I send you one example:
1 - Wharehouse code
10 - Customer Code
0000101 - Pallet code
122 - Unit code (unit that is in the pallet )
So for diferent wharehouses I can have the same pallet number and unit number.
But the Job Number it is always diferent.
Any ideia?
Regards,
Rui
- Attachments
-
- product.JPG (3.74 KiB) Viewed 6285 times
BR
Rui
Rui
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Complex Product Code
Whenever you use and auto-increment field it must be the primary key
Don't use auto-increment primary keys http://nubuilder.blogspot.com.au/2010/0 ... -keys.html
If you go to our current demo http://demo.nubuilder.com/db/samplenufinancial/ you will see how we create invoice numbers (go to Invoices).
If you go to the properties of Invoice Number..
In SQL Run Before Display You will see..
Then on the Text Tab
Default Value SQL you will see..
All this uses a table created like this..
This is the only time we use auto-increment (in a separate table) just to
generate a sequential number.
I hope this makes sense.
Steven
Don't use auto-increment primary keys http://nubuilder.blogspot.com.au/2010/0 ... -keys.html
If you go to our current demo http://demo.nubuilder.com/db/samplenufinancial/ you will see how we create invoice numbers (go to Invoices).
If you go to the properties of Invoice Number..
In SQL Run Before Display You will see..
Code: Select all
INSERT INTO next_number SET nxn_key = '#TT#'
Then on the Text Tab
Default Value SQL you will see..
Code: Select all
SELECT next_number_id FROM next_number WHERE nxn_key = '#TT#'
Code: Select all
CREATE TABLE IF NOT EXISTS `next_number` (`next_number_id` int(11) NOT NULL AUTO_INCREMENT,
`nxn_key` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`next_number_id`));
generate a sequential number.
I hope this makes sense.
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Complex Product Code
Hi Steven,
Thank you!
I see now how to use that code!
But I don't now how to use it to solve my problem.
Can you help me?
Best Regards,
Rui
Thank you!
I see now how to use that code!
But I don't now how to use it to solve my problem.
Can you help me?
Best Regards,
Rui
BR
Rui
Rui
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Complex Product Code
Rui,
Don't rely on a Primary Key to be your job number.
Create another field and use that to hold a job jumber.
And apply the code for generating a new number to that field.
If that still doesn't help, then I don't understand what your problem is.
Steven
Don't rely on a Primary Key to be your job number.
Create another field and use that to hold a job jumber.
And apply the code for generating a new number to that field.
If that still doesn't help, then I don't understand what your problem is.
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Complex Product Code
Hi Steven,
It helps! But following the example how can have:
Job Number: 1 10 0000101 122 and Job Number : 2 11 0000101 122
1 - Wharehouse code
10 - Customer Code
0000101 - Pallet code
122 - Unit code (unit that is in the pallet )
With your help now I know how to create the warehouse code / Customer Code / Pallet Code / Unit Code using tables.
The problem is ... how can I have the same Pallet Code in two diferente wharehouses (but the pallets are not the same)?
Thank You!
Best Regards,
Rui
It helps! But following the example how can have:
Job Number: 1 10 0000101 122 and Job Number : 2 11 0000101 122
1 - Wharehouse code
10 - Customer Code
0000101 - Pallet code
122 - Unit code (unit that is in the pallet )
With your help now I know how to create the warehouse code / Customer Code / Pallet Code / Unit Code using tables.
The problem is ... how can I have the same Pallet Code in two diferente wharehouses (but the pallets are not the same)?
Thank You!
Best Regards,
Rui
BR
Rui
Rui
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Complex Product Code
Rui,
That's like saying how can there be a person called "Bob" in 2 different countries, when they are not the same person.
I don't understand why that is a problem.
If you have to need to search for something sometimes you need to filter on more than one field.
eg.
Name AND Country
Pallet AND Warehouse.
Steven
That's like saying how can there be a person called "Bob" in 2 different countries, when they are not the same person.
I don't understand why that is a problem.
If you have to need to search for something sometimes you need to filter on more than one field.
eg.
Name AND Country
Pallet AND Warehouse.
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Complex Product Code
Hi Steven,
The problem is that I don't now how to do it.
Can you please help me?
Best Regards,
Rui
The problem is that I don't now how to do it.
Can you please help me?
Best Regards,
Rui
BR
Rui
Rui
-
- Site Admin
- Posts: 2786
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 3 times
Re: Complex Product Code
Rui,
I take it you know how to add fields like
Name AND Country AND Pallet AND Warehouse.
to an Edit Form.
So just add them to the Browse Form as well and you'll be able to find any record you need by typing what you are looking for in the Browse's Search Field.
1:10 into this tutorial you will be shown how to filter records. http://www.youtube.com/watch?v=1B-xz4Bf ... ure=relmfu
Steven
I take it you know how to add fields like
Name AND Country AND Pallet AND Warehouse.
to an Edit Form.
So just add them to the Browse Form as well and you'll be able to find any record you need by typing what you are looking for in the Browse's Search Field.
1:10 into this tutorial you will be shown how to filter records. http://www.youtube.com/watch?v=1B-xz4Bf ... ure=relmfu
Steven