[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Can't get picklist to work in DBGrid

Posted on 1998-04-01
10
Medium Priority
?
538 Views
Last Modified: 2010-04-06
I've got a dataset in a Microsoft SQL server environment. A field in the dataset is of type integer and contains fixed values 0 and 1. 0 means the payment was cash 1 means a bill has to be sent. I want the 0's en 1's to be displayed as translated text in the grid. According to the manual this should be possible by setting the ButtonStyle to cbsAuto and enter the translate list in the  PickList property.

I've tried this over and over but the numbers keep appearing and not the text from the PickList.

The manual states that the Table Field has to be a lookup field. But the only lookup fields I can create needs another table.
0
Comment
Question by:paulsinn
[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
  • 5
  • 4
10 Comments
 

Author Comment

by:paulsinn
ID: 1361175
Edited text of question
0
 

Expert Comment

by:phillipf
ID: 1361176
Do you want this field to be edited or is it just for display purposes?
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1361177
PS. why not using a byte as field type? You only use 0 and 1! Regards, Zif.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:paulsinn
ID: 1361178
Philipf
I just want to display.

ZifNab
I'm not using a byte value because the number of states might very well rise over the 256 boundary in the future. Besides where talking very small databases here!
0
 

Expert Comment

by:phillipf
ID: 1361179
Try This:

  Create a new calculated field of type string.(the size is completly up to you).  Then on the TTables OnCalcFields Event assign this new field a value based on the value of your interger field.

Below is what the TTables OnCalcFields event might look like.

procedure TForm1.Table1CalcFields(DataSet: TDataSet);
begin
  If Table1CashPay.Value = 0 Then
    Table1CashDesc.Value := 'Cash'
    Table1CashDesc.Value := 'Not Billed';
end;

Now if you don't want the users to see the integer field just set it's visible property to false.

I hope this helps.
 
 
0
 

Author Comment

by:paulsinn
ID: 1361180
phillipf

This probably will work but I don't want to be coding an endless if - then - else construction if more state arise. The anwer you gave doesn't solve the picklist problem. It creates a detour. Thanks anyway. I'm going to reopen the question for other experts.

Paul.
0
 

Expert Comment

by:phillipf
ID: 1361181
Would you have any objections to creating another table to be used to lookup these descriptions?  Since the number of states is going to be unknow (sorry I thought there were going to be only two) then this would probably be your best bet?
0
 

Author Comment

by:paulsinn
ID: 1361182
The issue isn't the lookup problem but why it won't work with the picklist as is documented in the manual. If I have to create a table for every lookup the number of tables will grow exponentionally!
0
 

Author Comment

by:paulsinn
ID: 1361183
philipf please read.

I earlier rejected Your answer on my problem. I've now come to the conclusion that that is the only way to do it. I've interpreted the Picklist wrong. I thought the Picklist would automatically translate info from the field to the picklist and visa versa but it doesn't. I think you're entitled to the points. Respond to this message and you'll get them.
0
 

Accepted Solution

by:
phillipf earned 100 total points
ID: 1361184
Paulsinn,

  I realize it is not the most graceful solution but unless you want to use lookup tables it is probably your best bet.


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

656 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