Hello,
Is there any workaround to make DBCOMBO to work with numeric Item field ? We are in the process of converting legacy application into FWH. And almost all the applications has numeric primary key in the master table. I am heavily stuck up here.
Can anybody guide me ?
TIA
Milan.
Workaround to make DBCOMBO to work with numeric Item field
-
- Posts: 115
- Joined: Mon Oct 17, 2005 4:42 am
- Location: India
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: Workaround to make DBCOMBO to work with numeric Item fie
Can't you just use Str( FieldName )?
EMG
EMG
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Milan,
You can preload the data into arrays (and convert the data to string while doing that). Then use the SET method:
METHOD SetItems( aItems, aList )
When you save the selected item no. you may need to convert it back to numeric.
The problem is that the data needs to be string for the combobox class which is the base class of dbcombo.
Another way would be to modify the dbcombo source. The downside is that you will either not automatically get any improvements to newer versions of DBCombo that come with FW.
Maybe the best thing would be to customize a copy of dbcombo and give it a new class name. That is probably what I would do, but if you are not familiar with writing classes this may take some effort for you.
James
You can preload the data into arrays (and convert the data to string while doing that). Then use the SET method:
METHOD SetItems( aItems, aList )
When you save the selected item no. you may need to convert it back to numeric.
The problem is that the data needs to be string for the combobox class which is the base class of dbcombo.
Another way would be to modify the dbcombo source. The downside is that you will either not automatically get any improvements to newer versions of DBCombo that come with FW.
Maybe the best thing would be to customize a copy of dbcombo and give it a new class name. That is probably what I would do, but if you are not familiar with writing classes this may take some effort for you.
James
-
- Posts: 115
- Joined: Mon Oct 17, 2005 4:42 am
- Location: India
Dear James,
Do u mean to say that I should try to array browse with DBCOMBO ? Even that do not seem to work as the value return by DBCOMBO is still numeric (i.e. still from Database). I had filled both aItems and aList with proper values (string one).
Can u please guide further ?
TIA
Milan.
Do u mean to say that I should try to array browse with DBCOMBO ? Even that do not seem to work as the value return by DBCOMBO is still numeric (i.e. still from Database). I had filled both aItems and aList with proper values (string one).
Can u please guide further ?
TIA
Milan.
James Bott wrote:Milan,
You can preload the data into arrays (and convert the data to string while doing that). Then use the SET method:
METHOD SetItems( aItems, aList )
When you save the selected item no. you may need to convert it back to numeric.
The problem is that the data needs to be string for the combobox class which is the base class of dbcombo.
Another way would be to modify the dbcombo source. The downside is that you will either not automatically get any improvements to newer versions of DBCombo that come with FW.
Maybe the best thing would be to customize a copy of dbcombo and give it a new class name. That is probably what I would do, but if you are not familiar with writing classes this may take some effort for you.
James
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Milan,
I see there is a bug in DBCombo when you try to pass the arrays in the definition like this:
@ 10,30 dbcombo oDBC var cItem of oDlg;
items aItems;
list aList
Instead do it like this:
@ 10,30 dbcombo oDBC var cItem of oDlg
oDBC:setItems( aItems, aList )
This is working for me.
James
Even that do not seem to work as the value return by DBCOMBO is still numeric (i.e. still from Database). I had filled both aItems and aList with proper values (string one).
I see there is a bug in DBCombo when you try to pass the arrays in the definition like this:
@ 10,30 dbcombo oDBC var cItem of oDlg;
items aItems;
list aList
Instead do it like this:
@ 10,30 dbcombo oDBC var cItem of oDlg
oDBC:setItems( aItems, aList )
This is working for me.
James