Solved

Using more than one value for list item

Posted on 2014-09-17
9
198 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 34

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
 
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
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.

 

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.

Join & Write a Comment

Suggested Solutions

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now