Var in loop
hello all,
I have a action script class which is bindable and
instantiates objects of other class
as :
quote:
[Bindable]
public class Templateobjects
public var template1 = new sampleTemplate1();
public var template2 = new sampleTemplate2();
public function Templateobjects(){
// constructor function
and in my mxml file i import this class as and trying to
access this variables in this class, as:
import Templateobjects;
public var templatelistObject:Templateobjects = new
Templateobjects();
for(var i:Objects in Templateobjects){
trace(" found objects");
i am not getting the trace...
please tell me how should i go about this.
Regards
Mayur
From the docs:
...you can use a for..in loop to iterate through the
properties of a generic object...What you cannot do is iterate
through the properties of an object if it is an instance of a
user-defined class, unless the class is a dynamic class. Even with
instances of dynamic classes, you will be able to iterate only
through properties that are added dynamically.
Similar Messages
-
New to PL/SQL and wondered if you can simply loop through records in order to ouptut as single string in a file?
DECLARE
v_string_rec VARCHAR(4000);
type v_cols is record;
BEGIN
FOR rec IN (SELECT * FROM PLAY_OWNER.STG_CUSTOMER)
-- somehow need to get the single record into record var then loop through that?
LOOP
FOR i IN v_cols.FIRST .. v_cols.LAST
LOOP
v_string_rec := recs(i) || v_string_rec;
END LOOP;
DBMS_OUPTPUT.PUT_LINE (v_string_rec);
-- UTL_FILE operations, insert rows
END LOOP;
END;
Give me a slap by all means, as I say kind of new to thisJust as a curiosity, using some xml capabilities we can obtain a strig concatenation of all columns of a given query this way:
SQL> with t as
2 (select xmltype(dbms_xmlgen.getxml(DBMS_XMLGEN.newContext('SELECT * FROM emp'))) doc
3 from dual)
4 select extract(column_value,'//text()') myrow
5 from t, table(xmlsequence(extract(t.doc,'/ROWSET/ROW')));
MYROW
7369SMITHCLERK790217-12-198080020
7499ALLENSALESMAN769820-02-1981160030030
7521WARDSALESMAN769822-02-1981125050030
7566JONESMANAGER783902-04-1981297520
7654MARTINSALESMAN769828-09-19811250140030
7698BLAKEMANAGER783901-05-1981285030
7782CLARKMANAGER783909-06-1981245010
7788SCOTTANALYST756619-04-1987300020
7839KINGPRESIDENT17-11-1981500010
7844TURNERSALESMAN769808-09-19811500030
7876ADAMSCLERK778823-05-1987110020
7900JAMESCLERK769803-12-198195030
7902FORDANALYST756603-12-1981300020
7934MILLERCLERK778223-01-1982130010
14 rows selected.And all the single attribute values this way:
SQL> with t as
2 (select xmltype(dbms_xmlgen.getxml(DBMS_XMLGEN.newContext('SELECT * FROM emp'))) doc
3 from dual)
4 select extract(column_value,'//text()') attribute_value
5 from (select column_value myrow
6 from t, table(xmlsequence(extract(t.doc,'/ROWSET/ROW')))
7 ) r, table(xmlsequence(extract(r.myrow,'/ROW/*')));
ATTRIBUTE_VALUE
7369
SMITH
CLERK
7902
17-12-1980
800
20
7499
ALLEN
SALESMAN
7698
20-02-1981
1600
300
30
7521
WARD
SALESMAN
7698
22-02-1981
1250
500
30
7566
JONES
MANAGER
7839
02-04-1981
2975
20
7654
MARTIN
SALESMAN
7698
28-09-1981
1250
1400
30
7698
BLAKE
MANAGER
7839
01-05-1981
2850
30
7782
CLARK
MANAGER
7839
09-06-1981
2450
10
7788
SCOTT
ANALYST
7566
19-04-1987
3000
20
7839
KING
PRESIDENT
17-11-1981
5000
10
7844
TURNER
SALESMAN
7698
08-09-1981
1500
0
30
7876
ADAMS
CLERK
7788
23-05-1987
1100
20
7900
JAMES
CLERK
7698
03-12-1981
950
30
7902
FORD
ANALYST
7566
03-12-1981
3000
20
7934
MILLER
CLERK
7782
23-01-1982
1300
10
101 rows selected.Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/23/la-forza-del-foglio-di-calcolo-in-una-query-la-clausola-model/] -
How do I display array values in a text field?
Hi there-
I have a small Flash movie I'm trying to complete, it's my
first go around with Flash 8 so I appreciate your patience:
I built an array with some actionscript which seems to work
fine (I can trace it and all is well in the trace window). Now I'm
simply trying to display it to my Flash movie screen and I've built
a dynamic text window which is working, except that I only ever get
the last array element to appear in the dynamic text window. I've
traced the code and see all of my array values, but when I use
"myResults_txt.text=picker_array;" I only see the last position's
value in my array. I tried playing with the "multiline" attribute
for the text field, it didn't seem to make any difference.
I'm sure it's probably something silly that I've missed, but
how do you display an array, with all of it's values to a dynamic
text field (I even tried using the textArea component but ran into
the same problem).
Thanks in advance for any help-
richThanks for your input. I tried just about everything but
ended up re-writing the contents of the array to a var and looping
through the var. Not my first choice but it got me to done.
Thanks again,
Rich -
How do I have Adobe Acrobat 9.0 calculate the minimum of 10 fields BUT ignore the field if it is empty? Currently it counts blanks as 0 so when it comes up with the minimum it will always show 0 unless all 10 fields have values in them.
You could loop through the fields and add the non-blank values to an array, and use the Math.min method to get the minimum. Here's an example custom Calculate script:
// Custom calculate script
(function () {
// Array to hold non-blank field values
var fa = [];
// Loop through the fields...
for (var i = 1; i < 11; i += 1) {
// ...get the current field value, as string...
var v = getField("text1." + i).valueAsString;
// ...if not blank, add value to the array, as a number
if (v) fa.push(+v);
// Set this field's value to the minimum value in the array, otherwise blank
event.value = fa.length > 0 ? Math.min.apply(null, fa) : "";
This assumes the fields are named "text1.1", "text1.2", ..."text1.10" and that they're numeric. This type of field naming simplifies the code, so it would be good to use something similar and adjust the getField statement to match. -
Please help with a custom javascript
Hello,
I am a military instructor, and I am trying to create a grade report card with Acrobat X Pro. So far I have made good progress with the help of the forum community (just searching through the pages and pages of posts), but I am stuck on this issue.
Like I stated, I am creating a report card (of sorts) where our other instructor staff can input student test grades into the fields as they [students] progress through training. The form is showing the particular test with an input field for the grade. Lastly, the student's overal GPA is displayed in percent format.
My conundrum: I am trying to code a field that all a user [instructor] will have to input is a numerical value with or without a decmil, and the field will display it as a percentage.
If I use acrobats default percentage, the number entered into the field will be multiplied by 100 (i.e. I enter 90 and acrobat displays 9000% in the field).
I would just like to be able to type in 90, and 90% be displayed; or type in 88.5, and 88.5% be displayed.
With the scripts I have entered, no decmils can be displayed, and the overal score is multiplying the average by 100, thus if I entered the number 90 in the first exam, the average calculates to 9000%.
I am assuming the custom format script and custom keystroke script made the average calculation script not work correctly.
Thanks in advance. Ryan
I have entered the following javascripts:
1. Document Level Script
// Document-level function
function DigOnlyKS() {
// Get all that is currently in the field
var val = AFMergeChange(event);
// Reject entry if anything but digits
event.rc = AFExactMatch(/\d*/, val);
2. Custom Format Script
// Custom Format script for text field
if (event.value) event.value += "%";
3. Custom Keystroke Script
// Custom Keystroke script
DigOnlyKS();
4. Custom Calculation Script for an Overal Grade Average
event.value = myAverageFunction(["pk1","pk2","pk3","pk4","pk5","pk6","pk7","pk8","pk9","pk10","pk11","p k12","pk13","pk14","pk15","pk16","pk17","pk18","pk19","pk20","pk21","pk22","pk23","pk24"," pk25"]);
function myAverageFunction(aNames) {
// n = number of fields that have a numerical value
// sum = some of values for the named fields
var n = 0;
var sum = 0;
var v;
// loop through array of name strings
for (i = 0; i < aNames.length; i++) {
v = this.getField(aNames[i]).valueAsString;
// check for not a null string and not a space and not is Not a Number
if (v != "" & v != " " & isNaN(v) == false) {
n++; // increment count
sum += Number(v); // add to sum
return (n != 0) ? (sum / n): "";Try,
I'm sorry for being so ignorant with javascript.
I placed that code in the custom keystroke like you suggested, but it did not work. Is there a specific way I need to input that code in the custom keystroke area?
I then tried to put it in the document level code and replaced (/\d*/, val) with your code... that really screwed thing up.
So now I am stuck where I was before.
I will try and show you what I am trying to accomplish:
Right now, this is what is happening
Exam 1
Exam 2
Exam 3
Final Average
95.5%
95.3%
94.3%
95.033333%
What I would like to do is to limit each field to 2 decmil places.
Each "exam field" has the following:
The "final average" field has the following:
and this is in the custom calculations area of the "final average" field:
Finally, I have this in the Documet JavaScripts area:
I have a feeling this is an easy fix, but I just cannot figure it out.
Thanks,
Ryan -
Averages in Adobe Acrobat X Pro
Hi All,
I am currently using Adobe Acrobat X Pro to create an employee performance survey, against 6 competencies the employees are rated from 1-5 or N/O if the competency is not observed. I have used an average calculation box to work out the overall average for each employee. However, if "N/O" is selected adobe takes it as "0" and still calculated the average out of 6 rather than 5. Is there any way to tell adobe is "N/O" is selected to not count this value and take the average only where a numerical score is assigned to the competency.
Thanks,
CarlaYou have to write a custom calculation script to perform that calculation since the built-in mean average calculation assumes that all fields will be used in the calculation and a field with no data or a null value will be treated as a zero value.
Since counting and summing are fairly common task and are used in the calculation of the mean I like to use 3 functions, a count, a sum and a division to calculate the mean and exclude the zero values.
function Sum() {
// compute the sum of the passed non-blank arguments
// input this function's call arguments
// returns: the sum of the non-null vlaues
var sum = 0;
var value = "";
// loop through passed arguemnts
for (i = 0; i < arguments.length; i++) {
if (arguments[i].toString() != "") {
value = Number(arguments[i]);
if(isNaN(value) == false) {
// eliminate not a number type of values
sum += Number(arguments[i]); // add numeric value to sum
} // end sum numbers
} // end numeric test
} // end argument loop
return sum;
} // end sum function
function Count() {
// compute the count of the passed non-blank arguments
// input this function's call arguments
// returns: the count of the non-null vlaues
var count = 0;
var value = "";
// loop through passed arguemnts
for (i = 0; i < arguments.length; i++) {
if (arguments[i].toString() != "") {
value = Number(arguments[i]);
if(isNaN(value) == false) {
// eliminate not a number type of values
count++; // increment the count
} // end count numbers
} // end numeric test
} // end argument loop
return count;
} // end sum function
function Avg(nCount, nSum) {
// compute the average of the passed non-blank arguments
// input: item count and sum of values
// returns: average on non-blank values or 0
// computge the average if count is a non-zero value
if (nCount != 0) return (nSum / nCount); // return average
else return 0;
// values to process
var total1 = this.getField('x').valueAsString;
var total2 = this.getField('y').valueAsString;
var total3 = this.getField('z').valueAsString;
event.value = Avg(Count(total1, total2, total3), Sum(total1, total2, total3)); -
This question was posted in response to the following article: http://help.adobe.com/en_US/acrobat/pro/using/WS58a04a822e3e50102bd615109794195ff-7df8.w.h tml
This is not easily scripted as yo need to provide the exact date pattern you want to use.
You can run the following script through your JavaScript console in Acrobat,. You will need to modify the field names and date format as needed to meet your needs.
// define an array of fields to change
var aFields = new Array("Text1", "Text2", "Text3", "Textn");
// define a character string for the date format
var cDateFormat = "dd-mmm-yyyy";
// define a field object to be used for setting the date format
var oField;
// loop through the field names and add the date format
for(i = 0; i < aFields.length; i++) {
// get the field object for i element in aFields
oField = this.getField(aFields[i]);
// set the date format
oField.setAction("Format", AFDate_FormatEx( cDateFormat));
// end loop field names - get next field name for processing
The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript)
There are other tools and methods to make forms besides the form Wizard. Most of us avoid it for most forms. -
How can i print a result in one line
hi guys
i have a small procedure as below
create or replace procedure test_sp is
l_str varchar2(2000) := replace('14522|||Lessig|||Minna|||Lessig, Minna','|||','|');
i pls_integer;
l_start_pos INTEGER := 1;
l_end_pos INTEGER :=1;
field_v varchar2(255);
begin
WHILE l_end_pos <> 0 LOOP
IF l_end_pos <> 0 THEN
l_end_pos := instr(l_str,'|',l_start_pos);
if l_end_pos = 0 then
dbms_output.put_line(l_str);
end if;
field_v := substr(l_str,1,instr(l_str,'|')-1);
l_str := substr(l_str,instr(l_str,'|')+1);
dbms_output.put_line(field_v);
END IF;
END LOOP;
when i execute the above procedure the result showed me like
14522
Lessig
Minna
Lessig, Minna
i would like to assign each value in different variable.
how can i do that?
Thankshi guys could you please take a look in my proc below
create or replace procedure test_sp is
l_str varchar2(2000) := replace('14522|||Lessig|||Minna|||Lessig, Minna','|||','|');
cnt pls_integer := 0;
l_start_pos INTEGER := 1;
l_end_pos INTEGER :=1;
field_v varchar2(255);
TYPE XYZ is TABLE OF VARCHAR2(2000) index by binary_integer;
var XYZ;
begin
for i in 1..4 loop
var(i) := ' ';
end loop;
for i in var.FIRST..var.LAST loop
IF l_end_pos <> 0 THEN
l_end_pos := instr(l_str,'|',l_start_pos);
if l_end_pos = 0 then
var(i) := substr(l_str,1,instr(l_str,'|')-1);
dbms_output.put_line(var(i));
end if;
l_str := substr(l_str,instr(l_str,'|')+1);
var(i) := substr(l_str,1,instr(l_str,'|')-1);
dbms_output.put_line(var(i));
END IF;
END LOOP;
end;
this procedure displaying the following result..
SQL> exec test_sp
Lessig
Minna
PL/SQL procedure successfully completed.
while it should print the following desire result.
14522
Lessig
Minna
Lessig, Minna
is any body tell why the above procedure not showing me a desired result?
Thanks -
Dynamic Column Name while Fetching from Cursor?
Scenario:
I have a table having 5 Column C01,C02,C03,C04,C05....... now i have
a record type variable att_rec. One first fetch the first record
fetch into att_rec and i can access column like
att_rec.C01,att_rec.C02 and so on simply i wan access these columns
through following Loop but unable to do so. It Understand the
att_Rec.C01 as String .. Any Clue ???
IF NOT attdays_cnt%ISOPEN
THEN
OPEN attdays_cnt;
END IF;
/* Keep fetching until no more records are FOUND */
FETCH attdays_cnt INTO att_rec;
message('Cursor Opened');
WHILE attdays_cnt%FOUND
LOOP
a31_cnt:=1; -- reinitializtion of variables for other employees
p_days:=0;
w_days:=0;
WHILE a31_cnt<32 LOOP
IF concat('ATT_REC.C',to_char(a31_cnt,'00'))='L'='P' THEN
p_days:=p_days+1;
ELSE ATT_REC.C01='W' THEN
w_days:=w_days+1;
END IF;
END LOOP;
Message was edited by:
Fiz DosaniPerhaps this is marginally simpler with nested table, YMMV ;-)
(based on Elic's example)
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> CRE ATE TABLE t (i, j, k)
2 AS
3 SELECT LEVEL, POWER (LEVEL, 2), POWER (LEVEL, 3)
4 FROM DUAL
5 CONNECT BY LEVEL <= 5;
Table created.
SQL> CREATE OR REPLACE type ntt_number AS TABLE OF NUMBER;
2 /
Type created.
SQL> SET SERVEROUTPUT ON;
SQL> DECLARE
2 TYPE t_tbl IS TABLE OF ntt_number;
3
4 var t_tbl;
5 BEGIN
6 SELECT ntt_number (i, j, k)
7 BULK COLLECT INTO var
8 FROM t;
9
10 FOR i IN 1 .. var.COUNT LOOP
11 FOR j IN 1 .. var (i).COUNT LOOP
12 DBMS_OUTPUT.PUT_LINE (
13 'var (' || i || ') (' || j || ') => ' || var (i) (j));
14 END LOOP;
15 END LOOP;
16 END;
17 /
var (1) (1) => 1
var (1) (2) => 1
var (1) (3) => 1
var (2) (1) => 2
var (2) (2) => 4
var (2) (3) => 8
var (3) (1) => 3
var (3) (2) => 9
var (3) (3) => 27
var (4) (1) => 4
var (4) (2) => 16
var (4) (3) => 64
var (5) (1) => 5
var (5) (2) => 25
var (5) (3) => 125
PL/SQL procedure successfully completed.
SQL> -
I have trouble prepolualting cfselect in the flash form. When
i click on the cfgrid I want specific drop down to be prepopulated
(i have 18 of them) based on the type.
Here is my cfgrid
<cfgrid name="myGrid" query="tempQuery" height="445"
width="200" rowheaders="false" onchange="#getComboBoxValue#">
<cfif menuQuery.menuID is not lloc>
<cfgridcolumn name="menuID" header="menuID" display="no"
/>
<cfgridcolumn name="label" header="label" />
<!--- <cfgridcolumn name="link" header="link"
/>--->
<cfset lloc= menuQuery.menuID>
</cfif>
</cfgrid>
And here is the drop downs
<cfloop index="i" list="#lLIst#">
<cfscript>
LoadaccessLevelType =
createObject("component","Erik.maintenace").LoadaccessLevelType(#i#);
</cfscript>
<cfselect query="LoadaccessLevelType" value="accessLevel"
display="description" name="access#i#" width="200"
label="#LoadaccessLevelType.display#"/>
</cfloop>
Where lList is number from 1 to 18.
My actionScript is here
<cfsavecontent variable="getComboBoxValue">
<cfloop query="TempQuery">
<cfif TempQuery.accessType neq ''>
//Set a temp variable to hold the current comboBox value
var temp1;
//Loop through all the comboBox values
for(var i = 0; i < access#accessType#.length; i++){
//if (myGrid.selectedItem.accessType == temp1) {
//set the comboBox to the current index
access#accessType#.selectedIndex=i;
//set temp to the value of the comboBox
temp1=access#accessType#.value;
//if temp equals the selected clientID then stop looping
through the comboBox
if(temp1==myGrid.selectedItem.accessValue){
break;
</cfif>
</cfloop>
</cfsavecontent >There are too many things going on: function call on an
object instance, actionscript function stored in a variable and the
grid itself. It is difficult to debug. I would start by using an
actual query to test the code. -
Calling PL/SQL from JavaScript
Hi,
I was wondering whether anyone has been able to successfully call a PL/SQL function from JavaScript and have the PL/SQL function return a result to the calling JavaScript function.
What I am wanting to do is, depending on what the value returned from the PL/SQL function is, either enable or disable a button on a web form. This would be done before displaying the form. We are current using 9iAS 1.0.2.2.2a and running Portal 3.0.9.8.0
Any ideas would be appreciated.
Regards,
Scott.Hi,
We have managed to create a solution to our problem. I have the copied in the code just incase other people are interested in what we did. We did this through Oracle Portal using the Additional PL/SQL Code section. Please see below.
is_user() is a PL/SQL function that checks whether the logged in user is a company user or client. It returns a VARCHAR2 of either "TRUE" or "FALSE".
... before displaying the form.
declare
lv_is_user varchar2(50) := is_user(portal30.wwctx_api.get_user);
begin
htp.p('<script language="JavaScript1.3">
function getItemObj(form,target)
var objname;
//Loop through all elements in the form
for(var j = 0; j < form.length; j++)
objname = form.elements[j].name.split(".");
if (objname[2] == target)
return form.elements[j];
function disableButton(form, btnName)
var isUser = "' || lv_is_user || '" ;
if (isUser == "FALSE")
var btnObj = getItemObj(form, btnName);
btnObj.disabled = true;
</script>');
END;
... after displaying the form.
htp.p('
<SCRIPT>
disableButton(document.forms[0], "FORM_BTN");
</SCRIPT> -
Populating multiple values in variable and accessing it in FOX
Hi Experts,
In one of my requirement, I have restricted a default value in the variable within modeler filter. The properties of variable are:
Manual Entry/Default Value, multiple single values, optional, and not ready for input.
I will need to access this variable in customer exit for Global Variables code (ZXRSRU01) and populate some values based on certain logic in a different variable (processed by customer exit). I will have to access this customer exit variable in FOX.
I want to understand whether the above mentioned linkage between FOX and cusotmer exit code is possible and further will I be able to access the customer exit variable values through VARC and VARI functions supported by FOX.
Appreciate if some one can post a document or link.
Thanks in advance,
Pankaj.Hi,
please check:
[http://help.sap.com/saphelp_sem40bw/helpdata/en/5d/12a0386de311d4b2f40050dadfb23f/content.htm]
[http://help.sap.com/saphelp_nw70/helpdata/EN/47/8776aa5129500be10000000a421937/frameset.htm]
Try using VARV, VARC and VARI and loops.
Hope this helps.
Regards Matthias -
Spry event listeners with dynamic form elements
Hi ,
I am trying to implement spry event listeners with a form that has dynamic check boxes and text field name. I now i can get the elements in a var and loop through with a normal function but can this work for spry events listenersShort answer is yes. But I have a feeling that you need further assistance, in which case give us a URL to a page that you want to apply the event listener to.
-
Clear page button- yes and cancel?
Hi all, I'm just learning javascript and could use some help. I have an Acrobat PDF form with a clear page button on the top. When the user clicks the button, I would like an alert to popup that says "Are you sure you wish to clear the page?". If the user clicks "Yes", the page clears. If the user clicks "No", the alert disappears and nothing else happens. I don't know how to get the cancel button to work, but everything else works fine. Here's my code:
var clearbutton = app.alert({
cMsg: "Are you sure you wish to clear the page?",
cTitle: "Clear Page?",
nIcon: 2, nType: 1
var iPage = pageNum;
var sFields = new Array();
for(var x=0;x<numFields;x++)
{var pg = getField(getNthFieldName(x)).page;
if((typeof pg == 'number' && pg == iPage) || (typeof pg != 'number' && pg.indexOf(iPage) > -1))sFields[sFields.length] = getNthFieldName(x);}
if(sFields.length > 0)resetForm(sFields);
How do I associate the cancel button (return of 2) with not continuing with the rest of the script? Thanks to anyone who can help out!!Try;
function ClearPage() {
var clearbutton = app.alert({
cMsg: "Are you sure you wish to clear the page?",
cTitle: "Clear Page?",
nIcon: 2, nType: 1});
if (clearbutton == 1) {
// "OK" selected
var iPage = this.pageNum;
var sFields = new Array();
var pg;
// loop through all fields and find fields on page
for(var x=0; x < numFields; x++){
pg = this.getField(getNthFieldName(x)).page;
if((typeof pg == 'number' && pg == iPage) || (typeof pg != 'number' && pg.indexOf(iPage) > -1))
sFields[sFields.length] = getNthFieldName(x); // fill array of field names
} // end for loop numFields
// clear the field names
this.resetForm(sFields);
} // end if 'OK"
// if anything other than "OK" nothing done
return;
} // end ClearPage funciton
// call the ClearPage function
ClearPage(); -
Trying to Create External Table in 8i
hi Grus,
We are still on 8.1.7 version. And oracle 8i doesn't support the External table feature. last week i found a very useful documentation to access an operating system file from SQPLUS. but i am having a small problem, may be one of you guys can give me a tip if i am doing something wrong. below is the story.
1) i created a object type with 4 attributes in database.
CREATE OR REPLACE TYPE Artist_Row_Type AS OBJECT
ARTIST_ID NUMBER(10),
LASTNAME VARCHAR2(255),
FIRSTNAME VARCHAR2(255),
LASTNAMEFIRSTNAME VARCHAR2(255)
2) Then i created a collection type of obove object type.
CREATE OR REPLACE TYPE artist_tab_type AS TABLE OF artist_row_type;
3) Created a function
CREATE OR REPLACE FUNCTION Get_Artist
RETURN artist_tab_type
IS
artist_tab artist_tab_type := artist_tab_type ();
l_file UTL_FILE.file_type;
l_text VARCHAR2 (2000);
l_orig_str VARCHAR2 (2000);
cnt PLS_INTEGER := 0;
l_start_pos INTEGER := 1;
l_end_pos INTEGER := 1;
TYPE xyz IS TABLE OF VARCHAR2 (2000)
INDEX BY BINARY_INTEGER;
var xyz;
BEGIN
l_file := UTL_FILE.fopen ('/export/home/taskmgr/SA/DAT', 'artist.dat', 'r');
BEGIN
FOR i IN 1 .. 4
LOOP
var (i) := ' ';
END LOOP;
LOOP
UTL_FILE.get_line (l_file, l_text);
FOR i IN var.FIRST .. var.LAST
LOOP
IF l_end_pos <> 0
THEN
l_end_pos := INSTR (l_text, '|', l_start_pos);
IF l_end_pos = 0
THEN
var (i) := l_text;
END IF;
l_orig_str := l_text;
l_text := SUBSTR (l_text, INSTR (l_text, '|') + 1);
IF l_end_pos <> 0
THEN
var (i) := SUBSTR (l_orig_str, 1, INSTR (l_orig_str, '|') - 1);
END IF;
END IF;
END LOOP;
artist_tab.EXTEND;
artist_tab (artist_tab.LAST) := artist_row_type (var (1), var (2), var (3), var (4));
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
END;
UTL_FILE.fclose (l_file);
RETURN artist_tab;
END;
suppoose first line in a external file is '14522|||Lessig|||Minna|||Lessig, Minna'
and when i execute the following query.
select * FROM TABLE(Cast(Get_Artist() AS artist_tab_Type));
i get the following result.
ARTIST_ID LASTNAME FIRSTNAME LASTNAMEFIRSTNAME
14522 Lessig
while i should get the following result
ARTIST_ID LASTNAME FIRSTNAME LASTNAMEFIRSTNAME
14522 Lessing Minna Lessig, Minna
is any body can have look in my function code if something is missing please let me know.
Thanks
AsifThe data in your file is separated by ||| (three pipes) but your routine is using | (one pipe) as its token.
Cheers, APC
Maybe you are looking for
-
Agentry Communication error 14
Hi, I am having trouble connect Android Client (Agentry_7.0.3.257_Client-Android) to Agentry Server Application. I am using Nexus 7 (Android version 4.1.2), the device is connected to corporate network via F5 Edge Client I can access SMP Cockpit via
-
Dear Gurus, Currently if I am using the fd32 transaction, and go into the payment history tab page, its shows me the blank data, would any of my guru confirm me the reason, and if I required how can I activate this, and what is the core purpose for t
-
Customize worklist app, add new column
Hi! I want to customize worklist application, add new columns to list which I want to fill in from database (withs SELECTs). This is not an easy task... I add the new columns as TaskAttribute (change the Login.java), so the new columns appear in the
-
Wht does itcsy refers and how this statment in frm or program works
hi when we call a program frm a form we use the below code can anyone explain me the full implication and process and how it works and waht it refers to fsap script form code : PERFORM GET_CODE IN PROGRAM z_PH3 using USING &vbak-VBELN& changing &ZIN
-
Select Query - a different perspective.
Hello all, I have to write a query to retrieve data from T156T ( movement type table ). Each movement type has got many Movement type description text. Now i need to get 3 movement types descriptions but only the top most value in the table of that p