Solved

Using more than one value for list item

Posted on 2014-09-17
9
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

749 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