I need to, ultimately, create a flatfile for exporting insurance information to a third-party vendor. Each individual is to have no more than 1 line per file, which contains their coverage information, if any, on 4 different type of insurance. What i need is for 1 field in a table to determine the output for multiple fields in the flatfile.
I think the best way to convey what i am trying accomplish is by;
If TABLE.FIELD1 = XXX then
then OUTPUT1 = Y
OUTPUT2 = N
OUTPUT3 = TABLE.FIELD3
OUTPUT4 = 3
OUTPUT5 = ("WORKING CASE STATEMENT")
else OUTPUT1 = N
OUTPUT2 = null
OUTPUT3 = null
OUTPUT4 = null
OUTPUT5 = null
If TABLE.FIELD1 = RRR then
then OUTPUT6 = Y
OUTPUT7 = N
OUTPUT8 = TABLE.FIELD3
OUTPUT9 = 3
OUTPUT10 = ("WORKING CASE STATEMENT")
else OUTPUT6 = N
OUTPUT7 = null
OUTPUT8 = null
OUTPUT9 = null
OUTPUT10 = null
Sorry if this is confusing, but what would be the best means of accomplishing this? I know a single CASE can't produce output for more than one field.
Thanks in advance.
5 2113
I need to, ultimately, create a flatfile for exporting insurance information to a third-party vendor. Each individual is to have no more than 1 line per file, which contains their coverage information, if any, on 4 different type of insurance. What i need is for 1 field in a table to determine the output for multiple fields in the flatfile.
I think the best way to convey what i am trying accomplish is by;
If TABLE.FIELD1 = XXX then
then OUTPUT1 = Y
OUTPUT2 = N
OUTPUT3 = TABLE.FIELD3
OUTPUT4 = 3
OUTPUT5 = ("WORKING CASE STATEMENT")
else OUTPUT1 = N
OUTPUT2 = null
OUTPUT3 = null
OUTPUT4 = null
OUTPUT5 = null
If TABLE.FIELD1 = RRR then
then OUTPUT6 = Y
OUTPUT7 = N
OUTPUT8 = TABLE.FIELD3
OUTPUT9 = 3
OUTPUT10 = ("WORKING CASE STATEMENT")
else OUTPUT6 = N
OUTPUT7 = null
OUTPUT8 = null
OUTPUT9 = null
OUTPUT10 = null
Sorry if this is confusing, but what would be the best means of accomplishing this? I know a single CASE can't produce output for more than one field.
Thanks in advance.
I think you're looking for UNION
try: - select
-
OUTPUT1 = Y,OUTPUT2 = N, OUTPUT3 = TABLE.FIELD3, OUTPUT4 = 3, OUTPUT5 = 'WORKING CASE STATEMENT',
-
OUTPUT6 = 'N', OUTPUT7 = null, OUTPUT8 = null, OUTPUT9 = null, OUTPUT10 = null
-
from YourTable where TABLE.FIELD1 = XXX
-
union
-
select OUTPUT1 = 'N', OUTPUT2 = null, OUTPUT3 = null, OUTPUT4 = null, OUTPUT5 = null,
-
OUTPUT6 = Y,OUTPUT7 = N, OUTPUT8 = TABLE.FIELD3, OUTPUT9 = 3, OUTPUT10 = 'WORKING CASE STATEMENT'
-
from yourtable where TABLE.FIELD1 = RRR
-- CK
UNION is not what I'm looking for. the value of the one fieild literally dictates the value of 20 others in one line of the report. i can have up to 3 types of insurance. if i have XXX then it populates those output fields 1-5, if i dont then it prints N in the first and leave the remaining blank. if i have YYY or ZZZ then it poulates fields 6-10 and 11-15, respectively.
UNION is not what I'm looking for. the value of the one fieild literally dictates the value of 20 others in one line of the report. i can have up to 3 types of insurance. if i have XXX then it populates those output fields 1-5, if i dont then it prints N in the first and leave the remaining blank. if i have YYY or ZZZ then it poulates fields 6-10 and 11-15, respectively.
try the following query hope will help you...
[code = sql]
SELECT Case TABLE.FIELD1
when 'xxx' or 'rrr' then 'y'
else 'n' end as output1 ,
Case TABLE.FIELD1
when 'xxx' or 'rrr' then 'n'
else null end as output2 ,
Case TABLE.FIELD1
when 'xxx' or 'rrr' then TABLE.FIELD3
else null end as output3 ,
Case TABLE.FIELD1
when 'xxx' or 'rrr' then 3
else null end as output4 ,
Case TABLE.FIELD1
when 'xxx' or 'rrr' then 'WORKING CASE STATEMENT'
else null end as output5
FROM TABLE_NAME
[/code]
Fantastic; crude but it gets the job done. thanks a bunch guys.
Update:
Ok, so it works, to an extent. While it does print the output in the correct fields, it only does so 1 type per line. If they have all 3 types of coverage, then they will have 3 seperate lines. It will correctly populate one of the 3 only once, while filling in the others as though they dont have that coverage. however, the remaining lines will follow suit; correctly state they have 1 type of covereage while claiming NO on the remaining, but i need all to appear on one line per person. i know this is confusing. if you need more clarification let me know.
thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ssb |
last post by:
Hello,
This may be very elementary, but, need help because I am new to access
programming.
(1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor
?) the values one by one and...
|
by: Richard Hollenbeck |
last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank
you. I try to ask relevant questions so that they don't just benefit me,
but also benefit the group. I'm currently...
|
by: James Fortune |
last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't
understand why people who know how to write code to completely replace
a front end do not write something that will automate...
|
by: Susan Bricker |
last post by:
Greetings.
I am having trouble populating text data that represents data in my
table. Here's the setup:
There is a People Table (name, address, phone, ...)
peopleID = autonumber key
There...
|
by: SueB |
last post by:
I currently have a 'mail-merge' process in my Access db project. It
generates custom filled out Award Certificates based on an SQL SELECT
statement in a VBA routine invoked by clicking on a...
|
by: Flanman |
last post by:
I have an ASP web form that I want to populate fields based on the first
field choice. Example I have 4 fields item, price, delivery, availability. I
have all these items setup in an access table....
|
by: pic078 via AccessMonster.com |
last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files)
that remains stuck in task manager after exiting the application - you can't
reopen database after exiting as a result...
|
by: SimpDogg |
last post by:
Hey guys another Newbie here...
I have a combobox(JobName) on my form tied to a
table named (Jobs) with one field for all of the
jobs in the comboxbox. I want to auto populate the
Due Out Date...
|
by: bpw22az |
last post by:
I am currently in the process of setting up an asp page that sends an inquiring student an email regarding his/her application status. The student enters his/her email address on a web page, the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |