Using Multiple Parameters in Select Statement
My goal is to be able to use more than one parameter for the select statement. When I use OR instead of AND it works but with only one parameter. I thought using AND would return any parameter that is listed in the ?Report Based On}. Any ideas why this will not work?
I've created four parameters:
Report Based on (string) Allow Multiple Values (Default Values: Customer, Part Id, and Serial Number)
RMA info by Customer (string)
RMA Info by Part Id (string)
RMA Info by SN (string)
This is my select statement
(if {?Report Based On} = "Customer" then
{RMA_Information.Customer}LIKE{?RMA info by Customer})
and
(if {?Report Based On} = "Part Id" then
{RMA_Information.Part Id}LIKE{?RMA Info by Part Id})
and
(if {?Report Based On} = "Serial Number" then
{RMA_Information.Serial Number}={?RMA Info by SN })
tx Shirley
Try this...
IF "Customer" IN {?Report Based On} AND
"Part Id" IN {?Report Based On} AND
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
{RMA_Information.Part Id}LIKE{?RMA Info by Part Id} AND
{RMA_Information.Serial Number}={?RMA Info by SN}
ELSE
IF "Customer" IN {?Report Based On} AND
"Part Id" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
{RMA_Information.Part Id}LIKE{?RMA Info by Part Id}
ELSE
IF "Customer" IN {?Report Based On} AND
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
{RMA_Information.Serial Number}={?RMA Info by SN}
ELSE
IF "Part Id" IN {?Report Based On} AND
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Part Id}LIKE{?RMA Info by Part Id} AND
{RMA_Information.Serial Number}={?RMA Info by SN}
ELSE
IF "Customer" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer}
ELSE
IF "Part Id" IN {?Report Based On}
THEN {RMA_Information.Part Id}LIKE{?RMA Info by Part Id}
ELSE
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Serial Number}={?RMA Info by SN}
HTH,
Jason
Similar Messages
-
How to use SET ID in select statement of SQ02
Hi,
I have a infoset, where for one of my Zfield, i have writen a select statement in order to get my ouput.
if aufk-aufnr = 'XYZ'.
select sum( FKBTR ) from fmifiit into zfmifiit
where fikrs = aufk-kokrs
and fipex IN capex
and wrttp NE '51'.
endif.
For the above statement, i have created (with 10 single values, table name FMCI, field name FIPEX) a SET id named CAPEX and used with IN operator.
But when i generating the infoset i am getting error like below
The IN operator with "CAPEX" is followed neither by an internal table nor by a value list
I was using IN opeartor for set ids during validation / substitutions, where if i have to validate multiple single values.
What to do here?
Regards,
Srinu[OPEN-SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_GENERAL.htm] set of statement, [SELECT|http://help.sap.com/abapdocu_70/en/ABAPWHERE.htm] statement, [WHERE|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP.htm] addition requires a selection table (type range, [WHERE - IN seltab |http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_SELTAB.htm]) of parameter and not a set. We are in Abap here, not in a Customizing screen
You have to convert the set to a selection table in an ABAP coding before using it in a SELECT statement.
(Check FM like G_SET_TREE_IMPORT to import definition of set (values and intervals) and map them to a select-table, or ask a developper to perform it, look at G_SET_TREE_IMPORT -> select statement)
Regards,
Raymond -
Error by using database procedure in select statement
hi ,
I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
plz help me how i can use a procedure in select statement. or can i do it or not.plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
The simply call this function in your select which internally calls the procedure. -
Using plsql tables in select statement of report query
Hi
Anyone have experience to use plsql table to select statement to create a report. In otherwords, How to run report using flat file (xx.txt) information like 10 records in flat files and use this 10 records to the report and run pdf files.
thanks in advance
sureshhi,
u can use the utl_file package to do that using a ref cursor query in the data model and u can have this code to read data from a flat file
declare
ur_file utl_file.file_type;
my_result varchar2(250);
begin
ur_file := UTL_FILE.FOPEN ('&directory', '&filename', 'r') ;
utl_file.get_line(ur_file, my_result);
dbms_output.put_line(my_result);
utl_file.fclose(ur_file);
end;
make sure u have an entry in ur init.ora saying that your
utl_file_dir = '\your directory where ur files reside'
cheers!
[email protected] -
Using java function in select statement
Hi,
I am trying to use java function in select statement.
public class ClassA{
private static String MyConst = "foo";
public static String functionA(){
return MyConst;
in my query I have:
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
ClassA is part of the application (no need to import).
I get and error of Invalid Expression on ClassA.functionA().
I also tried to declare the function in the processor element:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
<wlevs:processor>
but then I get a different error in the processor XML file: "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
What am I missing here?Hi,
From the above description, you have tried two manners to call method functionA() in the user defined class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
For user defined function manner, I think two things you need to change:
1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
</wlevs:processor>
2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
select A() from myChannel
Regards,
XiYing -
Create object type from multiple tables for select statement
Hi there,
I have 3 tables as given below and I wish to create an object type to group selected columns as 'attribute' from multiple tables.
I need to create 2 input parameters to pass in - 'attribute' and 'attribute value' in PL/SQL and these 2 parameters will be
passing in with 'column name' and 'column value'. e.g. 'configuration' - the column name, 'eval' - the column value.
Then, the PL/SQL will execute the select statement with the column and column value provided to output the record.
Pls advise and thank you.
table ccitemnumber
name null type
ccitemnumber not null varchar2(20)
configuration varchar2(20)
item_type varchar2(30)
table productmodel
productmodelnumber not null varchar2(6)
description varchar2(60)
accesstimems number
numberofheads varchar2(2)
generation varchar2(10)
numberofdiscs varchar2(2)
factoryapplication varchar2(150)
table topmodel
stmodelnumber not null varchar2(30)
productfamily varchar2(60
formfactor varchar2(10)
modelheight varchar2(10)
formattedcapacity number
formattedcapacity_uom varchar2(20)
object type in database
configuration varchar2(20)
item_type varchar2(30)
numberofheads varchar2(2)
generation varchar2(10)
numberofdiscs varchar2(2)
factoryapplication varchar2(150)
modelheight varchar2(10)
formattedcapacity number
formattedcapacuser12043838 wrote:
Reason to do this as these fields are required to be grouped together as they are created in different tables. They are treated as 'attribute' (consists of many columns) of the part number. So, the PL/SQL is requested to design in a way able for user to pass in the column name and column value or part number, then the select statement should be able to query for the records. Another reason is a new column can be added easily without keep modifying those effected programs. Reuseable too.This basically equates to ... hard to code, hard to maintain, and poor performance.
Are you really sure you want to do this? This isn't going to be easy-street as you seem to think it is, but it's a one way street to a poorly performing system with security vulnerabilities (google SQL Injection).
I would highly recommend you reconsider your design decision here. -
Using multiple events structure inside state machine to control the Tab
Hi y'all,
Anne here.I have a Tab indicator in my front panel and I want to be able to control the flow of my program based on what controls I clicked inside the tab. I am using a state machine architecture and inside every state, I use an event structure to check for user interaction to determine the next state and what tab page is going to be displayed next. This means that I am actually using multiple event structures in my application and I use them in just one while loop, but just that they are not running in parallel since I am only using "one event structure per state" which means that only one event structure is running at one time. My questions is, programming technique wise, am I doing it correctly? So far, I am not facing any problem (I am still in the early stage of the project) but I want to check with you all first on your opinion regarding this architecture. Will there be any issue on using multiple event structures in a vi? Since I will be using a tab, and the controls available in the tab will be the controls that will control my event structure for that state, by right, there should be no issue. Am I correct to assume this? Is there any limit on the use of event structures? I have attached here a simple sample of the architecture that I am talking about for your reference. I have attached a 2010 version and a 8.6 version. Let me know what you think or any opinions that you may have.
Hoping to hear from you soon! Thanks so much in advance!
Cheers!
Anne
Attachments:
State Machine-Event Structure Sample_2010.vi 19 KB
State Machine-Event Structure Sample_8.5.vi 25 KBHi jak888,
I decided to use tabs cause I don't want to have subvi pop ups every time i need to perform the process in the state and show an update in the front panel. This is actually going to be more of an ATE where you will have to choose first whether the one using is the operator or the engineer. If the operator is logged in, she will proceed to choose what test to run (this state will have its own event structure). This part, I don't want a pop up, so what happens is that from Login page, if the user logs in as operator, the tab will automatically switch to the Test Selection page. After selecting the test, it will proceed to Start Test state and the tab will show the Result Summary page. If the user logs in as engineer, then a totally different tab will be automatically shown next and so on. By doing this, I will be able to show an update on the front panel objects without having the subvis pop up. I will also just need to use the call reference functions to call my subvis, making my Main VI more generic. The tab Page header will be hidden so the operator will actually not see that there is a tab and that there are a lot of controls and indicators cause they are hidden in the tabs and that page will only be shown based on what they selected from the main tab.
I appreciate your thoughts! thanks so much! -
How to use 'is null' in select statement of ABAP program
hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data.
SELECT * FROM mara INTO TABLE it_mara
WHERE volum IS NULL .
Can anyone resolve this.Hi PKB,
Check the below thread for NULL and Space value in ABAP . It will help you
NULL and Space value in ABAP
Regards,
Pawan -
Use of wildcard * in SELECT statement
I have read that the use of the wildcard * in a SELECT statement cannot be utilized when using the INSERT INTO or other queries where data column/field alignment is critical. I have noted that the INSERT INTO column/fields must be in the same order
as the SELECT statement (as there is no alignment to column/field names). Can someone please provide me with the information or article that covered this scenario?It is consider a good practice to specify columns name, however , SQL Server is smart enough to insert the data without too , but only if the table does not have an IDENTITY property
CREATE TABLE #t (c1 int, c2 char(1),c3 real, c4 bit)
CREATE TABLE #t1 (c1 int, c2 char(1),c3 real, c4 bit)
---Same thing with INSERT like SELECT * you asked
INSERT INTO #t1 VALUES (1,'A',2.5,0)
INSERT INTO #t1 VALUES (2,'B',3.5,1)
INSERT INTO #t1 VALUES (3,'C',4.5,0)
INSERT INTO #t SELECT * FROM #t1
SELECT * FROM #t
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Using Variables in a select statement through a Database Adapter
I was wondering how I reference a variable in a select statement through a Database Adapter.
Ex.
1. I have a global variable that stores an employee number
2. I want to select an SSN # from a table based on an employee #
variable.
select ssn from emp where ssn = :input_variable - ????
- how do i reference the variable - I am getting a 'missing IN or OUT parameter error?
Any advice is much appreciated.
~ThanksI'm just wondering if anyone knows a work around so that I might be able to store a Table's FIELD name in a variable or an array[] so that I can do a query based on the decision of a loop without having to code 10 IF/ELSE statements.For instance, although the above code will not work, this code, although quite lengthy, does:
If DataGrid1.SelStartCol = 0 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES__PUR_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 1 Then
Adodc1.RecordSource = "Select * from tblReservation order by VENDOR"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 2 Then
Adodc1.RecordSource = "Select * from tblReservation order by VEN_LOC"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 3 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_TYPE"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 4 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_FROM_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 5 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_TO_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 6 Then
Adodc1.RecordSource = "Select * from tblReservation order by MISC_ADJ"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 7 Then
Adodc1.RecordSource = "Select * from tblReservation order by STATE_TAX"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 8 Then
Adodc1.RecordSource = "Select * from tblReservation order by LOC_CHARGE"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 9 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_ID"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 10 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_OP"
Adodc1.Refresh
End If
Do you see where i'm going with this?
I simple want to use a variable in the "select * from <Table> Order by <Field>" -
Using TRIM function in select statement
Hi All,
I'm using the TRIM function in my select statement to eliminate the white spaces.
But while using in select the TRIM function is not working in SQL*PLUS client(The query returns the white spaces also)
Kindly provide some pointers regarding the issue.........
I want to get only the data without the spaces in select statement
Regards,
MohanHi, Mohan,
SQL*Plus always pads columns to make them line up nicely.
If you have a column declared as VARCHAR2 (20), then SQL*Plus will normally display 20 characters for that column, even in the maximum actual length is, say, 5 (or even if the column always happens to be NULL).
If you want the output to include only the actual data, without the padding that SQL*Plus adds, then concatenate all the columns into one big string column.
People often do something like the following to generate a CSV file, with no exta spaces:
SELECT TO_CHAR (empno)
|| ',' || ename
|| ',' || job
|| ',' || TO_CHAR (deptno)
|| ',' || TO_CHAR (hiredate, 'DD-Mon-YYYY') AS all_data
FROM scott.emp; -
Parameters in select statement in JDBC Sender Adapter
Hi,
Is it possible to construct a SQL select statement with some parameters (for example: #currentdate )?
(for sender JBDC adapter)
Thank youhi,
you can very well construct a select statement.
The Source data type should be of this format:
<resultset>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
</resultset>
try this link:
http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
regards,
Priyanka -
Using variables in the Select statement
Here is my Select statement:
Set EmpDynaset = OraDatabase.CreateDynaset("select CU_NAME,CU_CONTACT from CU where CU_Name =" & cnt, 0&)
What's wrong with this? I'm trying to use the variable cnt. Any help? Thanks, JeremyHere is my Select statement:
Set EmpDynaset = OraDatabase.CreateDynaset("select CU_NAME,CU_CONTACT from CU where CU_Name =" & cnt, 0&)
What's wrong with this? I'm trying to use the variable cnt. Any help? Thanks, Jeremy Perhaps using the following:
("select CU_NAME,CU_CONTACT from CU where CU_Name = :variable")
then binding the variable to a value before executing the statement.. -
Delete adjacent duplicates how to use in the below select statement
hi i have a problem
i am suing the below select statement
SELECT a~extno
a~guid_lclic " for next select
e~ctsim
e~ctsex
*revised spec 3rd
f~guid_pobj
f~amnt_flt
f~amcur
f~guid_mobj
e~srvll "pk
e~ctsty "PK
e~lgreg "PK
INTO TABLE gt_sagmeld
FROM /SAPSLL/LCLIC as a
INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic " for ccngn1 selection
inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj
where a~extno in s_extno.
sort gt_sagmeld by guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ.
delete adjacent duplicates from gt_sagmeld comparing guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ .
now i am confused how to use delete adjacent dupliacate and on which fields
as first table /sal../lclic primary key is guid_lclic
and it is joined to table
legcon by guid_lclci ( not a primary key here)
legcon primary key is guid_legcon
and table 3 legsv by lgreg (pk here)
table 3 has tow more primary key srvll and ctsty also
NOW MY QUESTIO IS TAHT IS I USE ABOVE DELETE ADJACENT STATMENT IT FETCHES 20 LAKH RECORDS
I WANT TO REDUCE IS LET ME KNOW ON WHAT fields i need to use delete adjacen duplicates
or use comparing all fields?
regards
Arorahi sudha
if u see my select statement is contains four Primary keys
srvll
lgreg
ctsty
guid_lclic
but the next table connected to this table legcon is by guid_pobj and anothe table by guid_mobj
and if i take this gt_sagmeld to another temp table and i find abt 10 lakh uniques guid_pobj
similary 6 lakh guid_mobj so the next slect is hanpering because of this
not COMING TO OUR POINT IF I SORT ONLY BY OUR PRIMARY KEYS NOT TAKING INTO ACCOUNT TEH GUID_POBJ AND GUID_MOBJ
THE ENTRIES ARE VERY LESS BUT IF I TAKE INOT ACCCOUNT IN GT_SAGMELD THE ENTRIES ARE ABT 20 LAKH
SO I AM NOT SURE WHETHER TO TAKNE GUID_POBJ AND GUID_MOBJ INOT ACCOUNT FOR DELECTING ADJACENT DUPLICATES?
HENCE THE QUESTION OF ON WHICH FIRLD DELETE OR COMPARING ALL FIELDS I USE? -
Problem - Creating a Dynamic LOV using duplicate value in select statement
I am trying to create a Dynamic LOV by attempting to follow a pattern similar to the following:
select shop_name d, shop_id r
from shops
order by 1
However, I want to use the shop_name twice as in the following because I do not have any other unique identifier available such as a shop_id to associate with the shop name:
select shop_name d, shop_name r
from shops
order by 1
But I get an error where I am not allowed to duplicate the shop_name in the select statement. I read somewhere on this forum where it can be done but I can't find exactly how.
Can someone tell or show me how to accomplish this?
Thanks in anticipation for your answer.
Thanks,
RicRic,
I just tried to do this on APEX 3.0, and it worked just fine with this SQL:
select ename d, ename r from emp order by 1Perhaps you could put an example on apex.oracle.com or specify the error message that you're getting.
So as long as you have uniquely aliased both columns, this should not present a problem.
Thanks,
- Scott -
Maybe you are looking for
-
I just purchased the ExportPDF. When I try to convert a pdf document to word online, it gives me an error. What is the problem?
-
My iPhone 4's speaker is not working, and will not connect to my PC
Lately my phone has been acting strange. Initially, it stopped being able to take & receive calls- I couldn't hear the person on the other end, only through speaker phone or headphones. I let it die then left it off for a good 48 hours, when I turned
-
Installing 2 hard drives Problems
I have a k7n2 Delta ILSR and I just finished building it and setting up the bios and everything seems to be running pretty good. Currently, I have one hard drive (seagate) installed and I want to install a second hard drive (western digital caviar)
-
Thunderbird is not finding the mailbox folder
When viewing Folder Properties/General Information/Location -- the location field is empty / There have been no changes to the settings and Thunderbird has worked without any issues for years / Recently installed 31.5 / All other email accounts recei
-
I insert custom stamps into a PDF and sometimes they won't save to the JPG file... what am I doing incorrectly