You are on page 1of 2

How can I combine two columns into one where data may or may not exist?

- APSQA
http://www.apsqa.com/questions/65/how-can-i-combine-two-columns-into-one-where-data-may-or-may-not-exist[5/9/2012 8:18:30 PM]
spi
apsr
Follow this question
By Email:
Once you sign in you will be able
to subscribe for any updates here
By RSS:
Answers
Answers and Comments
Advanced Project Solutions
provide various services for users
of Intergraph's SmartPlant
applications.
APS Reporter is the
ideal tool for producing reports from
SPI (INtools), SPF and other
SmartPlant applications.
Tags:
23
1
Asked: May 12 '11 at 21:44
Seen: 314 times
Last updated: May 13 '11 at
00:54
Learn more about
APSQA
The APSQA website and
APSQA wiki are great resources
to help you learn more about the
various SmartPlant applications and
related programs.
Related questions
In SPI, Is it possible to restrict
users from making changes to
the cables after being built
from Reference Explorer?
How do I connect Barriers on
the same rail without using
questions tags users badges unanswered ask a question
login about faq
questions tags users
2
apsr spi
asked May 12 '11 at 21:44
Anthony
46226
edited May 13 '11 at 00:54
Brian
5572611
2 Answers:
2
How can I combine two columns into one where data
may or may not exist?
I currently have two Drawing.dwg_ names column in my query, one is called Document and the other called
dwg_name1. On my Report I would like to see one combined column but there is Data in both that differs.
The query must be something like this: If there is data in Document and the dwg_name1 then select Document
If there is data in Document and none in dwg_name1 then select Document
If there is No data in Document and there is data in dwg_name1 then select dwg_name1
and again if there is no data in either then the show the record exists
Hope this is not to confusing
You can use the SELECT CASE WHEN THEN Statement to create a new column in the query table "Reference_DWG"
You can then test boolean logic of "Document" and "DWG_NAME1" and assign a value to the Reference_Dwg field.
SQL Syntax below
SELECT CASE WHEN Document IS NOT NULL THEN Document WHEN Document IS NULL AND DWG_NAME IS
NOT NULL THEN DWG_NAME END AS Reference_Dwg
SQL Query below
Case When Cable_Sub.DWG_NAME Is Not Null Then Cable_Sub.DWG_NAME When Cable_Sub.DWG_NAME Is Null
And loop.DWG_NAME Is Not Null Then loop.DWG_NAME End As REFERENCE_DWG
oldest newest most voted
First time here? Check out the FAQ!
search
How can I combine two columns into one where data may or may not exist? - APSQA
http://www.apsqa.com/questions/65/how-can-i-combine-two-columns-into-one-where-data-may-or-may-not-exist[5/9/2012 8:18:30 PM]
jumpers
In SPI can I associate more
than on CS Tag with a Tag
number?
How can I create an air-gap
type radar used for level
In SPI, Can a Panel be copied
to another Plant?
Can SPI Loop Drawings be
saved in AutoCAD or
Microstation format?
Can SPI Rule Manager be used
to disable editing of one or
more UDFs?
In SPI, what is the easiest way
to move Cables from one Strip
to another?
In a Spi Instrument Browser
How do I select "Signal Type"
To be Displayed?
How do I duplicate a complete
Unit in SPI
link answered May 12 '11 at 22:16
Robin
1065613
0
link answered May 12 '11 at 22:21
Nick
3611312
There are a couple of ways of achieving the results you want. Either you can do it in the SQL statement by
concatenating the fields or you can use a calculated field in the report.
I don't know which would be the best or easiest however. Hopefully I can update my answer soon with some instructions
or someone else will post some.
Your answer
[hide preview] community wiki

You might also like