CameronF
Posts: 23
|
| Posted: 07/19/2004, 4:01 PM |
|
Hi all,
How do I set the value of a label in a grid to the value I want other than the key field? I want to show "Accounting" for the department instead of '7'? :)
I'm using MS SQL and vb.net. - if that matters. Thanks!!!
|
 |
 |
Don Safar
|
| Posted: 07/19/2004, 5:07 PM |
|
There are several way to accomplish. The easiest is to use query builder and
join the tables. Then in the label properties set the source to the joined
table field. You could also use beforerow and do a lookup of the description
and set the label to it.
"CameronF" <CameronF@forum.codecharge> wrote in message
news:240fc52c9b0ff6@news.codecharge.com...
> Hi all,
>
> How do I set the value of a label in a grid to the value I want other than
the
> key field? I want to show "Accounting" for the department instead of '7'?
:)
>
> I'm using MS SQL and vb.net. - if that matters. Thanks!!!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/19/2004, 5:10 PM |
|
Also take a look at the Employee Diretcory tutorial: http://docs.codecharge.com/studio/html/QuickStart/Creat...eryBuilder.html
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
jeverhart
|
| Posted: 02/06/2005, 9:32 PM |
|
When using a form I can have a list box with a list of values. Quite nice when I have a small number of items. Do not need a DB table .
Now I want to display the entered form data - so everything is a label rather than text box, list box, etc. How can I display the value I used rather than teh integer stored now that I am using a label field? I know I can write custom code and do a setvalue, but is there no CCS built-in way? Seems I coudl do this in CC.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 02/06/2005, 10:19 PM |
|
A simple way to do this would be the method discussed above, that uses multiple joined tables instead of a single table. Then you would also need to enable Custom Insert/Update/Delete, which should be quick & easy once you try it.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
jeverhart
|
| Posted: 02/07/2005, 4:53 AM |
|
Thanks Peter, but just to be clear. I have a fied in my main table which may have a value of 1 or 2. On my display form I do not want to display 1 or 2, I wish to display the corresponding values of "English" [which is 1] or "Spanish [whish is 2]. To do what I ask, the only options are:
1) Create a table that has the lookup values. Two rows: 1 English, 2 Spanish. Then Join this to the main table using "Build Query"
or
2) Write custom code that basically says : if field value = 1, SetValue of the label to English, else if field value = 2, SetValue of the label to Spanish.
There is not way to just use a List of Values in teh Properties pane to do a 1;English;2;SPanish like you can when you do a list box.
Is this correct? If so, I would like to make a wish to change this. CC coudl do it without haveing to wrote code or make a silly lookup table with two rows. So I wish CCS can do it too.,
I do love CCS, by the way. But this is a little irritant.
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 02/07/2005, 6:06 AM |
|
Jevehart,
If language names (English, Spanish, etc.) are stored in a table then please open Data Source dialog of a Grid form, click on Build Query button to open Visual Query Builder. There add both languages table and table where language_id are stored (1, 2, etc.) and join the tables on language_id field. Select fields you want to be shown on a form. Then select necessary fields from the Control Source list of a field. In this case no custom code is needed.
_________________
Regards,
Nicole |
 |
 |
Jeverhart
|
| Posted: 02/07/2005, 7:53 AM |
|
yeah, I do not want to create a table just to hold 2 rows. That is why LOV would be nice. But it looks like CCS does not really have that built in on the display side, just on eth list box side.
Thanks for all your comments and feedback in the past Nicole. As a lurker I have benefitted from it very often.
j9
|
|
|
 |
Don Safar
|
| Posted: 02/07/2005, 6:24 PM |
|
If your database supports the "Case" statement you can do it in the sql.
If your using SQL Server you would use something like this
Select
MyLanguage=
CASE
WHEN fldintval = 1 THEN 'English;
WHEN fldintval = 2 THEN 'Spanish'
ELSE 'DefaultLanguageNotSpecified'
END,
fld2,fld3,fld4.....
from yourtable name
where .....
orde by ....
I believe MySQL also has a case statement that is slightly different but you
should be able to see how it works at mysql.com.
If you are using access you would need to use the IIF statement.
"jeverhart" <jeverhart@forum.codecharge> wrote in message
news:24206fd5c846d6@news.codecharge.com...
> When using a form I can have a list box with a list of values. Quite nice
> when I
> have a small number of items. Do not need a DB table .
>
> Now I want to display the entered form data - so everything is a label
> rather
> than text box, list box, etc. How can I display the value I used rather
> than
> teh integer stored now that I am using a label field? I know I can write
> custom
> code and do a setvalue, but is there no CCS built-in way? Seems I coudl do
> this
> in CC.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
cobom
Posts: 55
|
| Posted: 03/02/2005, 5:02 AM |
|
I need something real close to 1 of the examples. I looked at the Employee Directory tutorial: http://docs.codecharge.com/studio/html/QuickStart/Creat...eryBuilder.html
It works great when the search field are text boxes. For the department name I type it in and hit search, I get all information relavant to the department. What I need is to be able to use a drop down box to select the department.
When running the grid builder I see an option to make the depatment field a list box - but after it completes I get only a 'Select', with no data listed.
If I change the data source, create another query builder, select dept_table.dept.name = {dept_name} it kinda works, but the drop down box lists every instance of department - ie. if there are 10 members of HR then HR appears in the drop down 10 times. Am I missing something here?
_________________
cmckinney@searay.com
Will program for a Sea Ray 680 SS ;} |
 |
 |
|