Solved

Using more than one value for list item

Posted on 2014-09-17
9
202 Views
Last Modified: 2014-09-24
hi
i have form , there is trigger to fill items in the list box like this
 ADD_LIST_ELEMENT('LST_ALPHA',1,RPAD(RTRIM(bs.QTY),10,' ')||'- ' ||RPAD(RTRIM( to_char(bs.tr_date, 'dd-mm-yyyy')),15,' ')||'- ' ||RPAD(RTRIM(bs.av_cost),10,' ')||'- ' ||RPAD(RTRIM(bs.tr_no1),10,' ')||'- ' ||RPAD(RTRIM(bs.sup_name),20,' '),bs.tr_no1);
  	  

Open in new window


now the value of each item in the list box is equal to bs.tr_no1
i have another button in same form will call a database procedure to perform some codes required  additional values from this list item such as :
qty , tr-date , av-cost , sup_name
how i can get all those values in one time
0
Comment
Question by:NiceMan331
  • 6
  • 2
9 Comments
 

Author Comment

by:NiceMan331
ID: 40327962
I forget to explain that  table provided the items of list item don't have uniqu item , I mean I cannot select from it the related record depend of tran_no1 , it will not solve , only need all those values which cursor return it in the list item
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 40329134
We don't have enough information from you to answer your question.  

My first question is: is this type of Form item the best way to solve this business problem in Oracle Forms?  The easiest way to populate items in an Oracle Form is to use "text" items in a database block and have Forms populate them via a query of a table or view.  If you choose to use other item types, and/or have the items *NOT* be database items, that makes the programming you have to do in Forms *MUCH* more complex!

My second question is: since you say that the table you need to retrieve these values from doesn't have a unique key, how do you plan to retrieve these items?  We don't know your database table structure or your application.  What criteria can be used to retrieve these items from the database?
0
 

Author Comment

by:NiceMan331
ID: 40334076
ok , i got think about one solution , but i need the code
i will concatenate the value of list item, like this

bs.tr_no1|| '-' ||qty|| '-' || tr-date|| '-' || av-cost || '-' || sup_name

Open in new window


now when i used value of the list item in the procedure , how i can split that string and sliced it by 5 values considering '-' between each one , i think instr & susbtr ?
but how ?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 22

Expert Comment

by:Helena Marková
ID: 40338719
There are many better examples than this one is:
declare
s_var VARCHAR2(200);
s_var_1 VARCHAR2(200);
n_length  PLS_INTEGER;
n_pos  PLS_INTEGER;
n_pos_1   PLS_INTEGER;
BEGIN
s_var:='a111b-a22222b-a5555b-a6666666666b-a888888888888888888b';
dbms_output.put_line(s_var);
n_pos_1:=1;
for i in 1 .. 4 loop
  n_pos:=instr(s_var,'-',1,i);
  n_length:= n_pos- n_pos_1;
  s_var_1:=substr(s_var,n_pos_1,n_length);
  dbms_output.put_line(s_var_1);
  n_pos_1:=n_pos + 1;
  IF i=4 THEN
    s_var_1:=substr(s_var,n_pos_1);
    dbms_output.put_line(s_var_1);  
  END IF;
end loop;
end;

This is an idea, you can write your own function.
0
 

Author Comment

by:NiceMan331
ID: 40338725
Thanx , let me try it
0
 

Author Comment

by:NiceMan331
ID: 40338941
yes correct
final question
your code answered my question if i know that i have 4 variables , ok , but in general , if i don't know how many variables , how can replace instead of 4 by x ?
0
 
LVL 22

Accepted Solution

by:
Helena Marková earned 500 total points
ID: 40339003
Here are some modifications:
declare
 s_var VARCHAR2(200);
 s_var_1 VARCHAR2(200);
 n_length  PLS_INTEGER;
 n_pos  PLS_INTEGER;
 n_pos_1   PLS_INTEGER;
 n_occurance  PLS_INTEGER;
 n_length_var  PLS_INTEGER;
 BEGIN
 s_var:='a111b-a22222b-a5555b-a6666666666b-a888888888888888888b-a44444b';
 dbms_output.put_line(s_var);
 n_length_var:=length(s_var);
 n_occurance:=0;
 FOR j in 1 .. n_length_var loop
  IF instr(s_var,'-',1,j)>0 THEN
    n_occurance:=n_occurance + 1;
  END IF;
 end loop;
 dbms_output.put_line(n_occurance);
 n_pos_1:=1;
 for i in 1 .. n_occurance loop
   n_pos:=instr(s_var,'-',1,i);
   n_length:= n_pos- n_pos_1;
   s_var_1:=substr(s_var,n_pos_1,n_length);
   dbms_output.put_line(s_var_1);
   n_pos_1:=n_pos + 1;
   IF i=n_occurance THEN
     s_var_1:=substr(s_var,n_pos_1);
     dbms_output.put_line(s_var_1);  
   END IF;
 end loop;
 end;
0
 

Author Comment

by:NiceMan331
ID: 40340880
sorry henka
the output not working with me
so please give me small time to solve this issue
http://www.experts-exchange.com/Software/Misc/Q_28524421.html
thanx alot
0
 

Author Comment

by:NiceMan331
ID: 40341190
yes henka
it is correct\
thanx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question