ABAP WD: get link's value in a table
Hello,
I have a table with links.
I need to get value of a link that user clicks on.
How can I get it?
Thank you.
Hi Georgy,
Check <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/33/b11042705a5533e10000000a155106/frameset.htm">Parameter Mapping</a>
Best regards, Maksim Rashchynski.
Similar Messages
-
How to get edited row values from ADF table?
JDev 11.
I have a table which is populated with data from Bean.
I need to save changes after user make changes in any table cell. InputText is defined for table column component.
I have defined ValueChangeListener for inputText field and AutoSubmit=true. So when user change value in inputText field, method is called:
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
getSelectedRow();
SaveMaterial(material);
This method should call getSelectedRow which take values from selected table row and save them into object:
private Row getSelectedRow(){
RichTable table = this.getMaterialTable();
Iterator selection = table.getSelectedRowKeys().iterator();
while (selection.hasNext())
Object key = selection.next();
table.setRowKey(key);
Object o = table.getRowData();
material = (MATERIAL) o;
System.out.println("Selected Material Desc = "+material.getEnumb());
return null;
Problem is that getSelectedRow method doesnt get new (edited) values, old values are still used.
I have tried to use ActiveButton with same method and it works fine in that case. New values are selected from active row and inserted into object.
JSF:
<af:table var="row" rowSelection="single" columnSelection="single"
value="#{ManageWO.material}" binding="#{ManageWO.materialTable}">
<af:column sortable="false" headerText="E-number">
<af:inputText value="#{row.enumb}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
</af:column>
<af:column sortable="false" headerText="Description">
<af:inputText value="#{row.desc}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
</af:column>
</af:table>
<af:activeCommandToolbarButton text="Save" action="#{ManageWO.EditData}"/>
What is a correct place from where save method should be called to get new (edited) values from ADF table?
Thanks.Did you look into the valueChangeEvent?
It has oldValue and newValue attributes.
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
Object oldVal = valueChangeEvent.getOldValue();
Object newVal = valueChangeEvent.getNewValue();
// check if you see what you are looking for.....
getSelectedRow();
SaveMaterial(material);
}Timo -
How to get all minimum values for a table of unique records?
I need to get the list of minimum value records for a table which has the below structure and data
create table emp (name varchar2(50),org varchar2(50),desig varchar2(50),salary number(10),year number(10));
insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',3000,2005);
insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',4000,2007);
insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2007);
insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2008);
insert into emp (name,org,desig,salary,year) values ('emp1','org1','mgr',7000,2010);
commit;
SELECT e.name,e.org,e.desig,min(e.year) FROM emp e,(
SELECT e1.name,e1.org,e1.desig,e1.salary FROM emp e1
GROUP BY (e1.name,e1.org,e1.desig,e1.salary)
HAVING COUNT(*) >1) min_query
WHERE min_query.name = e.name AND min_query.org = e.org AND min_query.desig =e.desig
AND min_query.salary = e.salary
group by (e.name,e.org,e.desig);With the above query i can get the least value year where the emp has maximum salary. It will return only one record. But i want to all the records which are minimum compare to the max year value
Required output
emp1 org1 mgr 7000 2008
emp1 org1 mgr 7000 2007Please help me with this..Frank,
Can I write the query like this in case of duplicates?
Definitely there would have been a better way than the query I've written.
WITH got_analytics AS
SELECT name, org, desig, salary, year
, MAX (SALARY) OVER ( PARTITION BY NAME, ORG, DESIG) AS MAX_SALARY
, ROW_NUMBER () OVER ( PARTITION BY NAME, ORG, DESIG, SALARY
ORDER BY year DESC
) AS YEAR_NUM
FROM (SELECT 'emp1' AS NAME, 'org1' AS ORG, 'mgr' AS DESIG, 3000 AS SALARY, 2005 AS YEAR FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',4000,2007 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',4000,2008 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2008 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL)
SELECT name, org, desig, salary, year
FROM got_analytics
WHERE salary = max_salary
AND YEAR_NUM > 1
Result:
emp1 org1 mgr 7000 2010
emp1 org1 mgr 7000 2008
emp1 org1 mgr 7000 2007
emp1 org1 mgr 7000 2007
WITH got_analytics AS
SELECT name, org, desig, salary, year
, MAX (SALARY) OVER ( PARTITION BY NAME, ORG, DESIG) AS MAX_SALARY
, ROW_NUMBER () OVER ( PARTITION BY NAME, ORG, DESIG, SALARY
ORDER BY year DESC
) AS YEAR_NUM
, ROW_NUMBER () OVER ( PARTITION BY NAME, ORG, DESIG, SALARY, Year
ORDER BY YEAR DESC
) AS year_num2
FROM (SELECT 'emp1' AS NAME, 'org1' AS ORG, 'mgr' AS DESIG, 3000 AS SALARY, 2005 AS YEAR FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',4000,2007 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',4000,2008 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2007 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2008 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL UNION ALL
SELECT 'emp1','org1','mgr',7000,2010 FROM DUAL)
SELECT name, org, desig, salary, year
FROM got_analytics
WHERE salary = max_salary
AND YEAR_NUM > 1
AND YEAR_NUM2 < 2
Result:
emp1 org1 mgr 7000 2008
emp1 org1 mgr 7000 2007 -
How to get custom field value in vbkd table using "SD_SALESDOCUMENT_CREATE" bapi
Hi Experts,
Need your help . In one program Iam using SD_SALESDOCUMENT_CREATE bapi .
i/p for my report is am excel.
excel is having below formatt.
To create salesdoc we are using SD_SALESDOC_CREATE bapi.
but After execution of the program we are unable to find the ZZFV_SBCNT (which is custom field) in VBKD w.r.t salesdocument.
Need your help what we need to do to reflect the value in vbkd table.
Here temp will contains the data from excel
1)
FORM f_move_header_data .
wg_header-doc_type = wg_temp-auart . "Order type
wg_header-sales_org = wg_temp-vkorg . "Sales Organization
wg_header-distr_chan = wg_temp-vtweg . "Distribution Channel
wg_header-division = wg_temp-spart. "Division
wg_header-sales_off = wg_temp-vkbur . "Sales Office
wg_header-sales_grp = wg_temp-vkgrp . "Sales Group
wg_header-purch_no_c = wg_temp-bstnk . "Customer purchase order number
wg_header-pymt_meth = wg_temp-zlsch . "Payment Method
wg_header-zzychan_role = wg_temp-zzychan_role_i. "Channel Role
wg_header-zzysub_role = wg_temp-zzysub_role . "Submitter Role
wg_header-zzy_inv_for_opt = wg_temp-zzinv_format . "Invoice Format Optio
wg_header-ord_reason = wg_temp-augru . "Order Reason Code
wg_header-bill_block = wg_temp-faksp. "Billing Block
wg_headerx-doc_type = c_set . "Order type
wg_headerx-sales_org = c_set . "Sales Organization
wg_headerx-distr_chan = c_set . "Distribution Channel
wg_headerx-division = c_set. "Division
wg_headerx-sales_off = c_set . "Sales Office
wg_headerx-sales_grp = c_set . "Sales Group
wg_headerx-purch_no_c = c_set . "Customer purchase order number
wg_headerx-pymt_meth = c_set . "Payment Method
wg_headerx-zzychan_role = c_set. "Channel Role
wg_headerx-zzysub_role = c_set . "Submitter Role
wg_headerx-zzy_inv_for_opt = c_set . "Invoice Format Option
wg_headerx-ord_reason = c_set . "Order Reason Code
wg_headerx-bill_block = c_set. "Billing Block
ENDFORM. " F_MOVE_HEADER_DATA
2)
FORM f_move_item_data .
wg_item-itm_number = g_itmnumber. "Item number
wg_item-material = wg_process-matnr . "Material
wg_item-target_qty = wg_process-target_qty. "Targeted Qty
wg_item-item_categ = wg_process-pstyv. "Sales document item category
wg_item-zzylegal_i = wg_process-zzlegal. "Legal Contract
**********Added this line for vbkd-ZZFV_SBCNT****************************
wg_item-zzfv_sbcnt = wg_process-zzfv_sbcnt.
APPEND wg_item TO i_item.
wg_itemx-material = c_set . "Material
wg_itemx-target_qty = c_set. "Targeted Qty
wg_itemx-item_categ = c_set. "Sales document item category
wg_itemx-zzylegal_i = c_set. "Legal Contract
wg_itemx-zzsteady_date = c_set . "Amortization Start Date
wg_itemx-zzsteady_end_dat = c_set. "Amortization Stop Date
**********Added this line for vbkd-ZZFV_SBCNT****************************
wg_itemx-ZZFV_SBCNt = c_set. "
APPEND wg_itemx TO i_itemx.
CLEAR : wg_itemx.
endform.
3)
FORM f_move_head_ext
wg_extension-structure = c_ext_vbak.
wg_ext_vbak-zzinv_format = wg_temp-zzinv_format.
wg_ext_vbak-zzychan_role = wg_temp-zzychan_role_i.
wg_ext_vbak-zzysub_role = wg_temp-zzysub_role.
wg_extension+30 = wg_ext_vbak.
APPEND wg_extension to i_extension.
CLEAR wg_extension.
wg_extensionx-structure = c_ext_vbakx.
wg_ext_vbakx-zzinv_format = c_set.
wg_ext_vbakx-zzlegal = c_set.
wg_ext_vbakx-zzychan_role = c_set.
wg_ext_vbakx-zzysub_role = c_set.
wg_extensionx+30 = wg_ext_vbakx.
APPEND wg_extensionx TO i_extensionx.
CLEAR wg_extensionx.
ENDFORM. " F_MOVE_HEAD_EXT
*& Form F_MOVE_ITEM_EXT
* Item Extension
4)
FORM f_move_item_ext .
* Structure for BAPI parameter Extension
wg_extension-structure = c_ext_vbap.
wg_ext_vbap-posnr = g_itmnumber.
wg_ext_vbap-zzsteady_date = wg_process-zzsteady_date . "Amortization Start Date
wg_ext_vbap-zzsteady_end_dat = wg_process-zzsteady_end_dat. "Amortization Stop Date
wg_ext_vbap-zzlegal = wg_process-zzlegal. "Legal Contract
wg_extension+30 = wg_ext_vbap.
APPEND wg_extension to i_extension.
* Structure for BAPI parameter Extension - Update Indicator Fields
wg_extensionx-structure = c_ext_vbapx.
wg_ext_vbapx-posnr = g_itmnumber.
wg_ext_vbapx-zzsteady_date = c_set .
wg_ext_vbapx-zzsteady_end_dat = c_set.
* wg_ext_vbapx-zzlegal = c_set.
*wg_process-zzfv_sbcnt = c_set.
wg_extensionx+30 = wg_ext_vbapx.
APPEND wg_extensionx TO i_extensionx.
CLEAR wg_extensionx.
and bapi calling is like below.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = wg_header
sales_header_inx = wg_headerx
logic_switch = wg_logic_switch
business_object = fp_bus_obj
status_buffer_refresh = 'X'
IMPORTING
salesdocument_ex = g_sorder
TABLES
return = i_return
sales_items_in = i_item
sales_items_inx = i_itemx
sales_partners = i_partner
sales_conditions_in = i_cond
sales_conditions_inx = i_condx
sales_text = i_text
extensionin = i_extension
extensionex = i_extensionx.
still we are not getting ZZFV_SBCNT value in VBKD table w.r.t created salesdoc(g_sorder)
Please help me from this issue.
Thank You..Hi,
Please let me know how to add custom fields in the characteristic list, My clients wants department and profit center grouping.
Please tell me how to solve it..
Thanks & Regards,
Reena.. -
Getting the attribute value from a table from page def using el expression.
Hi,
Am using Jdeveloper 11.1.2.0.0 and have a requirement as follows for which a sample is been created. Requirement is as follows..
1. Have a Taskflow that has a readonly table Employee.
2. On clicking of a button called "route" checks if the selected row , Manager id attribute value = 200 then navigate to first page else if manager id attribute value is 200 then navigate to second page.
Through the page def , if it has form , then we can access the attributes like #{data.view_FirstPageDef.ManagerId} . In case of acquiring the same attribute value from table using page def ? is what am unable to get..
Have achieved the routing concept using the Router activity on Taskflow. But am unable to get the selected row attribute value of a table from the employee page def.. Can someone suggest on the same...
Thanks and Regards,
Vinitha GOn the router, right click its icon in the task flow and create a page definition. Then in the page def file, add an iterator based on the same View Object from the table in the first page, then add a value attribute mapped to managerId in the View Object iterator. Finally in the router you can write EL expressions along the lines of #{bindings.ManagerId.inputValue = 200} or #{bindings.ManagerId.inputValue != 200}.
CM. -
How to get input text values from adf table - Urgent
Hi Friends,
This is my requirement. I designed customized master - detail - detail page. I customized the page in below format.
1. Master Data Field (Input text,etc) .
2. Detail in table format ( Rows are mapped to child table) and i given two buttons for to create row and delete row. I designed the table based on the example provided in forum for to create customized table. The input text component is mapped to the rows.
Now i want to retrieve all the data's entered in the rows. The table is mapped to child table. When i read the values from the table its showing null.
If any one faced this problem and fixed it, please send me the solution.
Thanks & Regards
VBDid you look into the valueChangeEvent?
It has oldValue and newValue attributes.
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
Object oldVal = valueChangeEvent.getOldValue();
Object newVal = valueChangeEvent.getNewValue();
// check if you see what you are looking for.....
getSelectedRow();
SaveMaterial(material);
}Timo -
Getting filter condition values from a table within the mapping
I have a table say mytable with columns as name, age and maritalstatus. I have another table paramtable with the following structure parametername, parametervalue. The data in this would be like say
Age >= 24
Maritalstatus F
Now from the table mytable I want to apply a filter which uses the values from the paramtable. Basically the filter condition should be something like
mytable.age >= 24 and maritalstatus = F
Any help on how this can be done within OWB?
Appreciate all the help i can getrveluthattil wrote:
I have a table say mytable with columns as name, age and maritalstatus. I have another table paramtable with the following structure parametername, parametervalue. The data in this would be like say
Age >= 24
Maritalstatus F
Now from the table mytable I want to apply a filter which uses the values from the paramtable. Basically the filter condition should be something like
mytable.age >= 24 and maritalstatus = F
Any help on how this can be done within OWB?
Appreciate all the help i can getoption 1. take table 1 and tabl2 into a joiner and apply this filter on the joiner.
2. If table 1 has age and marital status then you can straightaway apply a filter with the condition without using table 2.
if you are always going to link tabl1 and tab2 then perhaps using a joiner is the best way.
Edited by: Darthvader-647181 on Nov 6, 2008 5:49 AM -
How to get selected row values in a table using check box
Hi ADF Experts,
JDEV Version 11.1.1.7.0
My requirement is getting the selected row valuesof a af:table using a checkbox(multi select).
Thanks,
AnimeshHi,
add a transient attribute to the POJO entity and update this through a check box. The ensure you have autosubmit=true set on the check box. In a value change listener set or remove the row's checbox attribute value
Frank -
How to get column default value define on table?
Hi,
I am trying to get a table column default value with no success. I am using the Oracle Data Provider for .NET 10g Release 2 (10.2.0.2)
1). OracleConnection.GetSchema( "Columns", New System.String() {"<Owner>", "<Table_Name>"} returns everything BUT default value.
2). I tried querying oracle directly (sample below) but the default value comes back blank even though the column has one defined.
Dim oracleConnection As Oracle.DataAccess.Client.OracleConnection = factory.CreateConnection
Dim oracleCommand As New Oracle.DataAccess.Client.OracleCommand( _
"SELECT data_default FROM DBA_TAB_COLUMNS WHERE OWNER = 'TEST_SCHEMA' AND UPPER( TABLE_NAME ) = 'TEST' AND UPPER(COLUMN_NAM) = 'TESTCOL'")
oracleConnection.Open()
oracleCommand.Connection = oracleConnection
Dim oracleReader As Oracle.DataAccess.Client.OracleDataReader = oracleCommand.ExecuteReader
oracleReader.GetValue(0) 'This will return blank rather than default value for the column.
oracleReader.Read()
oracleReader.Close()
oracleConnection.Close()
Any help would be appreciated.
Thanks,
Rob Panosh
Advanced Software DesignsHi Rob,
I just ran up a quick test and I can't duplicate the behavior you describe.
I created a simple table as "scott":
SQL> create table def_test(c varchar2(32) default 'hello, world');
Table created.In my simple test I used the following C# code:
NOTE: There is an error in this code if using ODP.NET (see my post below for details on this)
using System;
using System.Data;
using System.Data.OracleClient;
class Program
static void Main(string[] args)
string constr = "user id=scott;" +
"password=tiger;" +
"data source=orademo;" +
"pooling=false;" +
"enlist=false";
OracleConnection con = new OracleConnection(constr);
con.Open();
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "select data_default " +
"from all_tab_columns " +
"where owner='SCOTT' " +
"and table_name='DEF_TEST' " +
"and column_name='C'";
OracleDataReader dr = cmd.ExecuteReader();
dr.Read();
string defaultValue = (string) dr.GetValue(0);
Console.WriteLine("Default value is: {0}", defaultValue);
dr.Dispose();
cmd.Dispose();
con.Dispose();
}Since the GetValue method returns an "object" I cast the value to a string and got the correct result.
However, I don't have a 10.2 ODP.NET environment right now so I was using 11.1 for this.
In your real code I suspect that you assign "oracleReader.GetValue(0)" to something - when you say "blank" do you mean zero length or a space or something else?
Regards,
Mark
Edited by: Mark Williams on Jul 31, 2009 10:02 AM -
Query to table in Database Link returns value from local table
Hi
I made a databaselink (Create database link db_a.world connect to db_a identified by <user> using 'db_a.world')
Then I query a table, connected as a user in db_b.world (this is our developer database - identical to db_a): Select count(*) from table@db_a.world.
When I get the result - it comes from the database I am logged in to (db_b)! - This is easy to check, because when I run select count(*) from table - it shows the same number. When I connect to the remote database, the same query shows another (correct) number.
When I created the database link, Oracle demanded a loopback clause. Why is that, and can this be the reason for the strange behaviour?
Thanx
Anders
Narvik, NorwayHi Anders,
A loopback database link is when you want to test connecting to the same database as say a different user. It can be used for testing purposes. Creating a database link doesn't require a loopback clause. The reason why you are getting the same row count as db_b.world because db_a.world has been created as a loopback link.
In the example you have Create database link db_a.world connect to db_a identified by <user> using 'db_a.world' , the clause after 'connect to' is meant to be the username and the clause after 'identified by' is meant to be the password.
So, create a regular database link like this:
create database link db_a_link connect to <user> identified by <passwd> using <service name>
You shouldn't get an error message that the loopback clause has to be specified. Then try querying and hopefully it will work.
-Raj -
How get link value of content selector
Hi everybody
I have a content selector and I display the content like this:
<pz:contentSelector rule="selecContenido" id="nodes"/>
<utility:notNull item="${nodes}">
<ul>
<utility:forEachInArray array="${nodes}" id="node" type="com.bea.content.Node">
<li><cm:getProperty id="node" name="title"/></li>
<li><cm:getProperty id="node" name="cellphone"/></li>
</utility:forEachInArray>
</ul>
</utility:notNull>
the "cellphone" property is a link to another content, then when I see the result of JSP, I get something like that:
*this is the title
*/BEA Repository/6005
How can I get the values of "cellphone" content?
THANKSSorry Ryan, I'm not very sure if I understand well, but I don't know how can I get the id and use it to get link content values.
<utility:forEachInArray array="${nodes}" id="node" type="com.bea.content.Node">
<cm:getProperty id="node" name="title"/>
HERE IS THE PROBLEM ( I need use <cm:getProperty id="node" name="cellphone"/>)
<utility:forEachInArray array="${nodes}" id="node" type="com.bea.content.Node">
<cm:getProperty id="node" name="cellphone_name"/>
</utility:forEachInArray>
</utility:forEachInArray>
thanks -
CE function to get distinct values from Column table
Hi All,
Could you please let me know the appropriate CE function to get the distinct values from column table.
IT_WORK = SELECT DISTINCT AUFNR FROM :IT_WO_DETAILS;
Thank you.Hi,
If you have 10g, you can use Model( with model performance is better than connect by )
Solution
========================================================================
WITH t AS
(SELECT '0989.726332, 1234.567432, 3453.736379, 3453.736379, 0989.726332, 3453.736379, 1234.567432, 1234.567432, 0989.726332'
txt
FROM DUAL)
SELECT DISTINCT TRIM(CHAINE)
FROM T
MODEL
RETURN UPDATED ROWS
DIMENSION BY (0 POSITION)
MEASURES (CAST( ' ' AS VARCHAR2(50)) AS CHAINE ,txt ,LENGTH(REGEXP_REPLACE(txt,'[^,]+',''))+1 NB_MOT)
RULES
(CHAINE[FOR POSITION FROM 1 TO NVL(NB_MOT[0],1) INCREMENT 1] =
CASE WHEN NB_MOT[0] IS NULL THEN TXT[0] ELSE REGEXP_SUBSTR(txt[0],'[^,]+',1,CV(POSITION)) END );
=========================================================================
Demo
=======================================================================
SQL> WITH t AS
2 (SELECT '0989.726332, 1234.567432, 3453.736379, 3453.736379, 0989.726332, 3453.736379, 123
4.567432, 1234.567432, 0989.726332'
3 txt
4 FROM DUAL)
5 SELECT DISTINCT TRIM(CHAINE)
6 FROM T
7 MODEL
8 RETURN UPDATED ROWS
9 DIMENSION BY (0 POSITION)
10 MEASURES (CAST( ' ' AS VARCHAR2(50)) AS CHAINE ,txt ,LENGTH(REGEXP_REPLACE(txt,'[^,]+',''))+1 NB_MOT)
11 RULES
12 (CHAINE[FOR POSITION FROM 1 TO NVL(NB_MOT[0],1) INCREMENT 1] =
13 CASE WHEN NB_MOT[0] IS NULL THEN TXT[0] ELSE REGEXP_SUBSTR(txt[0],'[^,]+',1,CV(POSITION)) END );
TRIM(CHAINE)
3453.736379
1234.567432
0989.726332
SQL>
======================================================================== -
Getting 2nd Least Value from Different Column
Hi there All,
I have one odd requirement.
I hava table which has diffrent columns of numeric Datatype.
The task is to get the least values from the table.
I can take the least value by least(col1,col2,col3 ...) function.Until this stage it is fine.
But also I have take 2nd least value and 3rd least value, which I am quite unsure how to get it.
Looking forward for suggestions.
Thanks in Advance.
Regards,
AjeetThe following is a generic solution that will allow you to select the nth least and allow you to pass as many column names as you like and will return null if the nth least requested exceeds the number of distinct values. The nleast function that I wrote uses the str2tbl function by Tom Kyte. I have included a demonstration of its usage below. The value returned for the 1st least is the same as that returned by the least function.
This should have been posted on the SQL and PL/SQL discussion group of these forums, rather than the general database. I also posted the same response in the SQL discussion group of the Orafaq forums.
scott@ORA92> -- test data:
scott@ORA92> SELECT * FROM your_table
2 /
COL1 COL2 COL3
1 2 3
4 6 5
8 7 9
11 12 10
15 13 14
18 17 16
6 rows selected.
scott@ORA92> -- type and functions:
scott@ORA92> create or replace type myTableType as table of number;
2 /
Type created.
scott@ORA92> create or replace function str2tbl( p_str in varchar2 )
2 return myTableType
3 as
4 l_str long default p_str || ',';
5 l_n number;
6 l_data myTableType := myTabletype();
7 begin
8 loop
9 l_n := instr( l_str, ',' );
10 exit when (nvl(l_n,0) = 0);
11 l_data.extend;
12 l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
13 l_str := substr( l_str, l_n+1 );
14 end loop;
15 return l_data;
16 end;
17 /
Function created.
scott@ORA92> CREATE OR REPLACE FUNCTION nleast
2 (p_n IN NUMBER,
3 p_nums IN VARCHAR2)
4 RETURN NUMBER
5 AS
6 v_nleast NUMBER;
7 BEGIN
8 SELECT DISTINCT column_value
9 INTO v_nleast
10 FROM (SELECT column_value,
11 DENSE_RANK () OVER (ORDER BY column_value) AS num_rk
12 FROM (select *
13 from table (CAST (str2tbl (p_nums) AS mytabletype)))
14 WHERE column_value IS NOT NULL)
15 WHERE num_rk = p_n;
16 RETURN v_nleast;
17 EXCEPTION
18 WHEN OTHERS THEN RETURN NULL;
19 END nleast;
20 /
Function created.
scott@ORA92> SHOW ERRORS
No errors.
scott@ORA92> -- query:
scott@ORA92> SELECT col1, col2, col3,
2 LEAST (col1, col2, col3) AS the_least,
3 nleast (1, col1 || ',' || col2 || ',' || col3) AS first_least,
4 nleast (2, col1 || ',' || col2 || ',' || col3) AS second_least,
5 nleast (3, col1 || ',' || col2 || ',' || col3) AS third_least,
6 nleast (4, col1 || ',' || col2 || ',' || col3) AS fourth_least
7 FROM your_table
8 /
COL1 COL2 COL3 THE_LEAST FIRST_LEAST SECOND_LEAST THIRD_LEAST FOURTH_LEAST
1 2 3 1 1 2 3
4 6 5 4 4 5 6
8 7 9 7 7 8 9
11 12 10 10 10 11 12
15 13 14 13 13 14 15
18 17 16 16 16 17 18
6 rows selected. -
Problem to get max string value
Hi
my problem is i don't get correct result when i get max string value from my table. for example, it returns '9' as max value while i have some bigger string values like 73, 80,65, ...
i found
some solutions to handle this problem (like converting to char or adding some zero in the begining of my value) but it does not appropriate for my situation because my string value maybe everything (some of my customers can use numbers while some other
else can use alphabetical+numbers)!.
can anybody help me ?
thanks in advance
http://www.codeproject.com/KB/codegen/DatabaseHelper.aspxWhen I see NVARCHAR(50)(50) I am pretty sure the data was declared by an ACCESS programmer who has no idea what he is doing. Do you really have first
and last names that need fifty UNICODE characters ? You will get them! If you invite garbage data, it will come. The USPS uses VARCHAR(20) for names; this has to do with the size of mailing labels and the fact
that Latin-1 is required by ISO in ALL languages.
lease read the "Stairway to Data" series and pay attention to last sections on the design of encoding schemes. What you have is useless and dangerous because it has no data integrity. Tag
numbers (learn what that means, please) need a regular expression and I like to have a check digit. My first guess, without an specs is that you need something like this:
patient _case_nbr CHAR() NOT NULL PRIMARY KEY
CHECK (patient _case_nbr
LIKE '[ ABC][0-9][0-9][0-9][0-9][0-9]')
Fixed length for the forms and display, characters limtied to the Latin-1 Unicode set, and easy to sort.
http://www.sqlservercentral.com/articles/Database+Design/72612/)
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Getting JS variable value in ABAP variable
hi experts,
I am fairly new to ABAP programming so please bear with me. To my issue.
I am creating a BSP which will read from the tax number table in CRM into an itab.
Next it loops into an wa and then passes each tax number through a javascript/JQuery API to validate the number.
The JSON response then comes back and is stored in a JS variable.
I am unclear how to get this into an ABAP variable so I can handle as needed. I have read some posts but they seem to be created for those ABAP experts which I am not there yet.
Any help is most appreciated.
thank you kindly!
ChrisThanks for the reply Kiran.
I am still stuck where I try to create the hidden field, assign the JS variable value to it and then retrieve on server side using ABAP.
I read some places where it mentions accessing in the controller but this is not specific enough for me to know what to do. Here is a snippet of my JS/html code.
<form id="api">
<div><input type="hidden" name="json" id="json" value="" /></div>
var json = data;
document.getElementById("json").value = json;
document.api.submit();
</form>
I am using a Jquery api to get a boolean value and storing it in the json variable. then I want to pass that value to an ABAP variable. I did maintain a page attribute of json type STRING as well. I also tried maintaining a controller class attribute of the same. I did not redefine any controller class methods.
Your help is most appreciated.
thx
Chris
Maybe you are looking for
-
How do I set up my iCloud account on this phone
-
Is there any way I can switch Automatic Backup off?
Is there any way I can turn automatic backups off in Logic Pro 8? Apple has set it so you can't switch them off any more. (You could switch them off in Logic versions 6 and 7.) I see other people have had this problem and it has been discussed on the
-
C2-03 Browser and Email client
Dear Nokia Team, Further to the topic "Nokia C2-03 Lacking Some basic options" (by newsoftware, replied by mahayv, Nokia's Technical Expert) which would be great to be improved, C2-03's browser & email client should be also fixed. Browser: - Can not
-
How do I copy to dvd to watch on my normal tv
How do I copy to dvd to watch on my normal tv. I bought it so I assume I own it in the same way as if I bought a dvd from a store, so I would like to sit down and watch my programs and or films I buy on itunes on my normal tv set rather than in my o
-
After updating itunes 10.4 when editing tags in file adds two or three covers. This problem is represented as in 10.6.8 and in 10.7. Earlier albums were edited with the same cover. or 3