Re: Map code to label in query
From: John Spencer (MVP) (spencer4_at_comcast.net)
Date: 07/16/04
- Next message: Dale Fye: "Re: Unmatced Record per day"
- Previous message: John Spencer (MVP): "Re: How to do this Update Query"
- In reply to: Ted Allen: "Map code to label in query"
- Next in thread: Ted Allen: "Map code to label in query"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 15 Jul 2004 21:42:50 -0400
You can implement the suggestion given by Ted Allen and it will work, but in my
opinion you are almost always better off adding the translation table. It
becomes very easy to handle any new code values, just add one record to one
table. Or if someone decides that "Spouse" should be "Significant Other" or
"Life Partner" or "Dependent" should be "Child" or "Household Minor", again you
edit one record.
If you use the hard-coding method, you have to locate every instance where you
have coded this conversion and make the change. Plus if you end up with more
than 3 or 4 values, the code gets very cumbersome to read.
Just my thoughts, take them for what they cost you.
Ted Allen wrote:
>
> If you only have 3 codes, you can just use something like
> the following as the field source:
>
> Name: iif(Code = 1,"Member",iif(Code = 2,"Spouse",iif
> (Code = 3,"Dependent","")))
>
> HTH, Ted Allen
> >-----Original Message-----
> >I am running a query that groups an indicator code. I
> >would like to label the code. Here are the results of
> the
> >query:
> >
> >Code Sum
> > 1 3500.00
> > 2 2500.00
> > 3 1000.00
> >
> >The code field is grouped "Group by" in the query.
> >
> >I would like to map the code to an english name. Here
> is
> >what I would like to see:
> >
> >Code Sum Name
> > 1 3500.00 Member
> > 2 2500.00 Spouse
> > 3 1000.00 Dependent
> >
> >I could create a separate table with that identifies the
> >name for each code and then join to my original table
> but
> >I would like to avoid that if possible.
> >
> >Is there a way to do this in the query?
> >
> >Thanks in advance.
> >
> >Attila
> >
> >.
> >
- Next message: Dale Fye: "Re: Unmatced Record per day"
- Previous message: John Spencer (MVP): "Re: How to do this Update Query"
- In reply to: Ted Allen: "Map code to label in query"
- Next in thread: Ted Allen: "Map code to label in query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|