Help!! recursive function call
* The function which build the category tree
public String categoryTree(Statement stat, boolean isMore, int id) {
if(!isMore) {
return "";
else
String sql = " select t_category_relation.category_relation_id, t_category_relation.level_in, " +
" t_category_item.category_item_id, t_category_item.category_name_jpn_NV from " +
" t_category_item, t_category_relation " +
" where " +
" t_category_item.category_item_id = t_category_relation.category_item_id and " +
" t_category_relation.parent_id = " + id + " and t_category_relation.parent_id<>0";
// return sql;
try{
ResultSet res = stat.executeQuery(sql);
String spacer = "";
String input = "";
while(res.next()) {
int level = res.getInt(2);
id = res.getInt(1);
for(int i = 0; i < level; i ++) {
spacer +=" ";
input ="+ id: " +id + " NAME " + res.getString(4) + "\n</td>\n<td align=center>\n<input type=checkbox value=" +String.valueOf(id) + " name=categoryid>\n</td>\n</tr>\n";
return "\t\t<TR>\n\t\t\t<TD>" + spacer + input + categoryTree(stat, true, id);
if(spacer.equals("")){
return input+categoryTree(stat, false, id);
}catch(SQLException e) {
return "SQL Exception";
return categoryTree(stat, false, id);
}I am writing a menu generated base on a tree like relation ship that is store in a database. assume
vegetable has two child and one of the child has another child and so forth.
But I am getting a result like this:
vegetable-->
<1>childe
<1.1>childe
but missing <2>child
because the while loop doesn't continous looping after the 1.1.
please help me out
thanx in advance
>
Re: help!! recursive function call
Author: DrClap Aug 3, 2001 1:15 PM
When you call the method recursively, the second call makes a second query to the database, before you have finished using the ResultSet from the first query. Since you are using the same Statement, executing the second query causes the first query to, um, disappear.
The API documentation for java.sql.Statement says this: "Only one ResultSet object per Statement object can be open at any point in time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All statement execute methods implicitly close a statment's current ResultSet object if an open one exists."
thanx for your reply!
public String categoryTree(int id) {
String sql = " select t_category_relation.category_relation_id, t_category_relation.level_in, " +
" t_category_item.category_item_id, t_category_item.category_name_jpn_NV from " +
" t_category_item, t_category_relation " +
" where " +
" t_category_item.category_item_id = t_category_relation.category_item_id and " +
" t_category_relation.parent_id = " + id;
try{
Connection con = DataSourceUtil.getConnection("name");
Statement stat = con.createStatement();
ResultSet res = stat.executeQuery(sql);
String spacer = "";
String row = "";
while(res.next()) {
int level = res.getInt(2);
id = res.getInt(1);
for(int i = 0; i < level; i++) {
spacer +=" ";
row = " \t\t<tr>\n " +
" \t\t\t<td colspan='2'>" + spacer + " <a href=inventory_edit_product.jsp?categoryid=" + id +">" + res.getString(4) + "</a></td>\n" +
" \t\t</tr>\n ";
return (row + categoryTree(id));
con.close();
}catch(SQLException e) {
return "<tr><td colspan=2>SQL Exception</td></tr>";
return "";
}New I think every recursive call will have it's own statement and resultSet but I am still getting same problem. The while loop stopped when calls reached first base case. Does anybody know why. I expect, assume that while loop will go next when a call reaches the base case which will return "".
Thanx for help
Similar Messages
-
Validation of recursive function call fails
We want to use a call to a recursive function from a HTMLDB application. It should be used in a page region to generate a query string ("PL/SQL function body returning SQL query"). Everything works fine with a call to a non-recursive function. The recursive function also works fine when called from SQL+.
After pressing "Apply changes" on "HTML DB Home>Builder - Application 148>Page Definition>Edit Page Region"-page I get the following error message after a long delay:
Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing
(ORA-00600: internal error code, arguments: [kohdtf048], [], [], [], [], [], [], [])
I assume that the validation routine follows the recursion until the memory limit is reached.
Please give me a hint how to solve this problem.
DB version: 10.1.0.2.0
HTMLDB version: 1.5.0.00.33
running on Win2000 serverSince the original function is confidential, I have created a simple one showing the same behavior (and the same error). Termination does not depend on session state:
Called function (to replace spaces with #):
create or replace function MF_Test
p_querystring varchar2
return varchar2 is
v_position integer;
begin
v_position:=instr(p_querystring,' ');
if v_position=0 then /* termination condition */
return p_querystring;
else
return substr(p_querystring,1,v_position-1)||'#'||MF_Test(substr(p_querystring,v_position+1));
end if;
end MF_Test;
calling function (from the page region, to generate a query string):
declare
q varchar2(500);
begin
q:='select * from hardware where model=''';
q:=q||mf_test(:P3_SEARCH);
q:=q||'''';
end
Validation seems not to terminate in case of recursive function calls.
Thanks for your input. -
How to collect returns from recursive function calls without a global var?
Usually global variables shouldnt be used, I was told. Ok. But:
How can I avoid using a global var when recursively using a function, when the function returns an object and when I want to have the collection of all these objects as the result?
For example, I think of determine the users of a group including group nesting. I would write a function that adds the direct group members to a collection as a global var and call itself recusively if a member is another group. This recursively called function
would do as well: Update the global var and if needed call itself.
I'm afraid this is no good programming style. What algorithm would be better, prettier? Please dont focus on the example, it is a more general question of how to do.
Thanks
WalterI rarely needed to create/use recursive functions. Here's one example I did:
function New-SBSeed {
<#
.Synopsis
Function to create files for disk performance testing. Files will have random numbers as content.
File name will have 'Seed' prefix and .txt extension.
.Description
Function will start with the smallest seed file of 10KB, and end with the Seed file specified in the -SeedSize parameter.
Function will create seed files in order of magnitude starting with 10KB and ending with 'SeedSize'.
Files will be created in the current folder.
.Parameter SeedSize
Size of the largest seed file generated. Accepted values are:
10KB
100KB
1MB
10MB
100MB
1GB
10GB
100GB
1TB
.Example
New-SBSeed -SeedSize 10MB -Verbose
This example creates seed files starting from the smallest seed 10KB to the seed size specified in the -SeedSize parameter 10MB.
To see the output you can type in:
Get-ChildItem -Path .\ -Filter *Seed*
Sample output:
Mode LastWriteTime Length Name
-a--- 8/6/2014 8:26 AM 102544 Seed100KB.txt
-a--- 8/6/2014 8:26 AM 10254 Seed10KB.txt
-a--- 8/6/2014 8:39 AM 10254444 Seed10MB.txt
-a--- 8/6/2014 8:26 AM 1025444 Seed1MB.txt
.Link
https://superwidgets.wordpress.com/category/powershell/
.Notes
Function by Sam Boutros
v1.0 - 08/01/2014
#>
[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Low')]
Param(
[Parameter(Mandatory=$true,
ValueFromPipeLine=$true,
ValueFromPipeLineByPropertyName=$true,
Position=0)]
[Alias('Seed')]
[ValidateSet(10KB,100KB,1MB,10MB,100MB,1GB,10GB,100GB,1TB)]
[Int64]$SeedSize
$Acceptable = @(10KB,100KB,1MB,10MB,100MB,1GB,10GB,100GB,1TB)
$Strings = @("10KB","100KB","1MB","10MB","100MB","1GB","10GB","100GB","1TB")
for ($i=0; $i -lt $Acceptable.Count; $i++) {
if ($SeedSize -eq $Acceptable[$i]) { $Seed = $i }
$SeedName = "Seed" + $Strings[$Seed] + ".txt"
if ($Acceptable[$Seed] -eq 10KB) { # Smallest seed starts from scratch
$Duration = Measure-Command {
do {Get-Random -Minimum 100000000 -Maximum 999999999 |
out-file -Filepath $SeedName -append} while ((Get-Item $SeedName).length -lt $Acceptable[$Seed])
} else { # Each subsequent seed depends on the prior one
$PriorSeed = "Seed" + $Strings[$Seed-1] + ".txt"
if ( -not (Test-Path $PriorSeed)) { New-SBSeed $Acceptable[$Seed-1] } # Recursive function :)
$Duration = Measure-Command {
$command = @'
cmd.exe /C copy $PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed+$PriorSeed $SeedName /y
Invoke-Expression -Command:$command
Get-Random -Minimum 100000000 -Maximum 999999999 | out-file -Filepath $SeedName -append
Write-Verbose ("Created " + $Strings[$Seed] + " seed $SeedName file in " + $Duration.TotalSeconds + " seconds")
This is part of the SBTools module and is used by the
Test-SBDisk function.
Example use:
New-SBSeed 10GB -Verbose
Test-SBDisk is a multi-threaded function that puts IO load on target disk subsystem and can be used to simulate workloads from multiple machines hitting the same SAN at the same time, and measure disk IO and performance.
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) _________________________________________________________________________________
Powershell: Learn it before it's an emergency http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx -
Please help me on recursive function call
* The function which build the category tree
public String categoryTree(Statement stat, boolean isMore, int id) {
if(!isMore) {
return "";
else
String sql = " select t_category_relation.category_relation_id, t_category_relation.level_in, " +
" t_category_item.category_item_id, t_category_item.category_name_jpn_NV from " +
" t_category_item, t_category_relation " +
" where " +
" t_category_item.category_item_id = t_category_relation.category_item_id and " +
" t_category_relation.parent_id = " + id + " and t_category_relation.parent_id<>0";
// return sql;
try{
ResultSet res = stat.executeQuery(sql);
String spacer = "";
String input = "";
while(res.next()) {
int level = res.getInt(2);
id = res.getInt(1);
for(int i = 0; i < level; i ++) {
spacer +=" ";
input ="+ id: " +id + " NAME " + res.getString(4) + "\n</td>\n<td align=center>\n<input type=checkbox value=" +String.valueOf(id) + " name=categoryid>\n</td>\n</tr>\n";
return "\t\t<TR>\n\t\t\t<TD>" + spacer + input + categoryTree(stat, true, id);
if(spacer.equals("")){
return input+categoryTree(stat, false, id);
}catch(SQLException e) {
return "SQL Exception";
return categoryTree(stat, false, id);
} I am writing a recusive function which can generate a tree like category tree for customer navigation purpose.I don't know why my will loop only return once which means if category "vegetable" has two child and one of child has another child but the result will only display vegetable-->child-->grand child instead of vegetable-> 2 child -> one grand child of one of the child.Please help exam the codethax inDidn't I already answer this?
-
Recursive function call 'CABM_READ_BOM'
Hi,
I need to do a recursive call to 'CABM_READ_BOM' using different matnr each time. Data will be stored in i_exp_bom_head and i_exp_bom_item. Since this is a recursive call to the same routine and iterations depend on the level of BOM how can I keep track of the internal tables returned by its level?
FORM READ_BOM using p_matnr.
CALL FUNCTION 'CABM_READ_BOM'
EXPORTING
i_matnr = p_matnr
i_werks = i_bom_select-werks
i_vbeln = i_bom_select-vbeln
i_vbpos = i_bom_select-posnr
i_stlal = i_bom_select-stlal
i_stlan = i_bom_select-stlan
i_datuv = i_bom_select-erdat
TABLES
exp_bom_data = i_exp_bom_head
exp_itm_data = i_exp_bom_item
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
LOOP AT i_exp_bom_item WHERE postp = 'N'.
PERFORM READ_BOM using i_exp_bom_item-idnrk.
ENDLOOP.
ENDFORM.
Points will be awarded.
Thanks!Hi Subramanian,
Thank you for your prompt reply.
I'm trying to create master BOM and sub BOM depending on how many levels it is.
IF i_exp_bom_item-POSTP = 'N' then I call the function module again to create sub BOM. I will call the function module recursively until i_exp_bom_item-POSTP <> 'N'. That will be the lowest level.
Message was edited by:
Alex Nguyen -
Help with recursive function to print number patterns
I'm sorry for having to ask for homework help - I'm badly stuck on this! Can someone give me a kick in the right direction with this?
need a recursive function with a single positive int parameter n. the function should write (2^n - 1) integers and should be in the following pattern...
n = 1, Output: 1
n = 2, Output: 1 2 1
n = 3, Output: 1 2 1 3 1 2 1
n = 4, Output: 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1
n = 5, Output: 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1
function should valid for all positive integer values of n
This was tagged as a 'short' problem...so it shouldnt take too much code...I am hung on on the following:
*Do I keep track of the numbers printed, if so how? I only have a single parameter to call with so I am confused as to how I could get an entire pattern without keeping track of the history
*I had initially thought it would be necessary to cut it in half and do the 2nd half backwards (ie: for n=3, I would take care of the 1 2 1 - then 3 - then 1 2 1...but even then it seems like I could cut 1 2 1 in half the same way and therefor I should be able to do ALL of it in single parts...
Can someone veer me in the right direction here? I'm really lost with this.This was tagged as a 'short' problem...so it shouldnt
take too much code...Yeah, the method body could be done in a few lines.
I am hung on on the following:
*Do I keep track of the numbers printed, if so how?Not explicitly. Use the call stack. That is, use the fact that when you're recursing, the previous values of numbers are preserved in the previous method invocation.
I only have a single parameter to call with so I am
confused as to how I could get an entire pattern
without keeping track of the historyYou don't have to store anything across method invocations.
I had initially thought it would be necessary to cut
it in half and do the 2nd half backwards (ie: for
n=3, I would take care of the 1 2 1 - then 3 - then 1
2 1...but even then it seems like I could cut 1 2 1
in half the same way and therefor I should be able to
do ALL of it in single parts...No, it's MUCH simpler than that. It's easier than yo uthink.
Can someone veer me in the right direction here? I'm
really lost with this.Try this simpler version of the problem:
Write a recursive method that creates this output:
n = 1: 1
n = 2: 1 2
n = 3: 1 2 3
And try this simpler version:
n = 1: 1
n = 2: 2 1
n = 3: 3 2 1 -
Calling Recursive function in a transaction
Hello All
I have a requirement calling Recursive function in Transaction.Means inside a transaction, i want to call the same transaction.Is it possible to do like this?
Because when i am calling like this,transaction is running contineously without stop.
Any help would be highly appreciated.
Thanks,
ManishaManisha,
take a look on this thread:
Does xMII support recursive Business Logic Modules
Hope Ricks solution can help you.
Regards
Pedro
Edited by: Pedro Iglesias on Dec 19, 2008 9:56 AM -
I can't search a song or an artist without getting an error R6025 - pure virtual function call. Then itunes stops working. How do I fix it? PLEASE HELP
I have had numerous issues with Itunes 64 bit 11.1.38 (and other previous versions) locking up and crashing upon start with "Itunes has stopped working" or "R6027 pure virtual function call". I have researched the answers around the forums as well as having tried some extensive and repetitious troubleshooting myself and thought I'd list them here... in order of troubleshooting...
1. Install all Windows updates and reboot. This seems to clear issues from time-to-time... I suspect Itunes expects the latest-and-greatest as far as Windows is concerned.. see if this clears your issue.
2. Uninstall all Itunes and Apple products & reboot, remove their directories, remove lingering Itunes registry entries, reboot again, reinstall using "RUN AS ADMINISTRATOR" to install the Itunes executable. See if this allows Itunes to stabilize. Pelase be sure to use the following guide from Apple as far as removing the apps and directories are concerned...
http://support.apple.com/kb/ht1923
3. Remove the contents of the "iphone photo cache" (or other related product photo cache) directory.
4. Try editing the shortcut properties and configure the shortcut (for all users) to run as Administrator.
5. Try editing the shortcut and configure it to run in Compatibility Mode for Windows 7 (for all users).
6. a.Try using MSCONFIG to locate a potential conflicting application or service using the following...
http://support.apple.com/kb/ht2292
or
6. b. Remove the last recent software application(s) you may have installed... in my case removing GREENSHOT http://getgreenshot.org/ stopped my Itunes from crashing on startup and it stabilized after
driving my nuts for weeks.
Message was edited by: DaCheeze -
While trying to use my iTunes library it will suddenly stop working with the error message Runtime error R6025 pure virtual function call.
Help???Just responded to this in another thread (note we used Captivate 7 so it might be a different error).
We found that when we created files with embedded swf files that existed ABOVE widgets in the timeline, when someone else tried to open our file it broke/we got the runtime error. The original person could still open it for a time, but eventually the cache would clear and they couldn't.
However, if we ensured swf files are BELOW widgets in the source files, it didn't break. In fact, if we found one that was breaking and got the author to move the swf file on the timeline, it would start working for others.
STRANGE! Let me know if this works for you to! -
Help:alternate for calling function in where clause
Hi ,
In below query i'm calling function in where clause to avoid COMPLETE status records,due to this query taking 700 secs to return result.If i'm remove below function condition it's returning results with in 5 secs.Can you some one advice to any alternate idea for this?
WHERE mark_status != 'COMPLETE'
SELECT assessment_school,
subject,
subject_option,
lvl,
component,mark_status,
mark_status
NULL AS grade_status,
NULL AS sample_status,
:v_year,
:v_month,
:v_formated_date,
:v_type,
cand_lang
FROM
(SELECT assessment_school,
subject,
subject_option,
lvl,
programme,
component,
paper_code,
cand_lang,
mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) AS mark_status
FROM
(SELECT DISTINCT ccr.assessment_school,
ccr.subject,
ccr.subject_option,
ccr.lvl,
ccr.programme,
ccr.language AS cand_lang,
ccr.paper_code,
ccr.component
FROM candidate_component_reg ccr
WHERE ccr.split_session_year = :v_year
AND ccr.split_session_month = :v_month
AND EXISTS
(SELECT 1
FROM IBIS.subject_component sc
WHERE sc.year = ccr.split_session_year
AND sc.month = ccr.split_session_month
AND sc.paper_code = ccr.paper_code
AND sc.assessment_type = 'INTERNAL'
AND sc.subject_option NOT LIKE '%self taught%'
AND sc.component NOT IN ('PERFORMANCE PRODUCTION','PRESENTATION WORK','REFLECTIVE PROJECT','SPECIAL SYLLABUS INT. ASSESSMENT')
AND NVL(ccr.withdrawn,'N') = 'N'
AND ccr.mark_status != 'COMPLETE'
AND EXISTS
(SELECT 1
FROM school s
WHERE s.school_code = ccr.assessment_school
AND s.training_school = 'N'
WHERE mark_status != 'COMPLETE';One thing you can test quickly is to put the function call in it's own select ...from dual.
This might make a difference.
However, only you can check this, I don't have your tables or data.
So, what happens if you use:
paper_code,
cand_lang,
(select mark_entry.get_ia_entry_status(:v_year, :v_month, assessment_school, subject_option, lvl, cand_lang, component, paper_code) from dual ) AS mark_status
FROM
(SELECT DISTINCT ccr.assessment_school, --<< is the DISTINCT really needed?
ccr.subject,
ccr.subject_option,
...Also, try to find out the purpose of that above DISTINCT, is it really needed or is there some join missing? -
Help:Function call from CFScript
I need to write a function call within
<cfscript></cfscript> but not sure with the syntax. I
got error message with the suntax I wrote (see below).
All I need is for the function AddVal () to pass an Array
within the existing loop.
<CFSCRIPT>
//Existing codes
Function ExistingFunction(ParameterA) {
//some codes here
for ( i = 1; i LTE listLen( fileCon, crlf ); i = i + 1 ) {
//some codes was written here to generate a 2 dimensional
Array called: MyArray
// I need to write my function here, so on every loop it
will pass an array to be inserted to DB
function AddVa(MyArray); >>>>> ??????????????
<CFFUNCTION name="AddVal">
<cfargument name="MyVal" type="Array" required="true">
<cfquery name="MyQuery datasource="MyDatasource>
// insert statement here
</cfquery>
</CFFUNCTION>
</CFSCRIPT>pls try this.
//syntax to call a function inside cfscript is given below.
//variablename = functionname(pass ur argument);
change ur code like this.
<!--- First, clean up the CFSCRIPT block --->
<CFSCRIPT>
function ExistingFunction(ParameterA) {
//some codes here
for ( i = 1; i LTE listLen( fileCon, crlf ); i = i + 1 ) {
//some codes was written here to generate a 2 dimensional
Array called: MyArray
getIP=AddVal(MyArray);//syntax to call a function inside
cfscript.
</CFSCRIPT>
<!--- since you're doing a query move this function
outside the CFSCRIPT block
...you can still call it from your CFSCRIPT block --->
<CFFUNCTION name="AddVal">
<cfargument name="MyVal" type="Array" required="true">
<cfquery name="MyQuery datasource="MyDatasource>
// insert statement here
</cfquery>
</CFFUNCTION>
try this and inform. -
Basically, the functions are on the html document in which the SMIL file is embedded and the flash file within the SMIL file calls the function from a button.
The code on the html doc determines whether the browser is Netscape or IE and then executes the appropriate code. For ex. for Netscape the function is:
document.radio.SetSource('video.smi')
and for IE the function is:
radio.SetSource('video.smi')
All the function calls work fine in IE but in Netscape it does nothing.Basically, the functions are on the html document in which the SMIL file is embedded and the flash file within the SMIL file calls the function from a button.
The code on the html doc determines whether the browser is Netscape or IE and then executes the appropriate code. For ex. for Netscape the function is:
document.radio.SetSource('video.smi')
and for IE the function is:
radio.SetSource('video.smi')
All the function calls work fine in IE but in Netscape it does nothing. -
How to define recursive functions in JSP
Hi,
If anybody knows, how to to define recursive functions pls help. I am using an XML file for the creation of a tree menu. In order to display the menu, i have to use recursive functions...Also out.println throwing error in the function..
Thanks,
PhilipsI do not have my Java book at work with me today so you'll have to bear with me. The following routine assumes that you can get some sort of branch object from your tree menu object (also assuming you have something like this). Furthermore, it assumes that the branch object can return some sort of collection of all leaves and branches on a particular branch through a made-up getLeaves() method call.
<%!
public void displayLeaves(Branch branch)
Iterator branches = null;
branches = branch.getLeaves().getIterator();
Object leaf = null;
while( branches.hasMoreItems() )
leaf = branches.nextItem();
if(leaf instanceof branch)
displayLeaves((Branch) leaf);
else
out.println( ((Leaf)leaf).getValue() );
%>This code fragment should be just the logic you need to expand a tree as JSP output. To invoke this method all you have to do is pass the root branch element to the method from within your JSP. Please let me know if you need additional info. -
Function sequence error / Recursive functions error
Hi! I've a little problem over here. I have an application (servlet) that makes recursive functions with DB access. This function contains a resultset that calls the same function again until no more data is found. The problem, is that I'm using JDBC-ODBC bridge (because this must work in SQL Server, Informix, Sybase, Access and Oracle), so I need to make commit of the connection in every resultset. If I make the commit inside the resultset, I got a "Function Sequence error" exception. Of course, I can't close every statement inside the resultset (or at least I don't know how). My code looks like this:
public void myfunction(String odbc,String data1,String data2) throws SQLException,Exception{
//this class, myclassDB, just return a established connection with the DB
Connection connection = myclassDB.connect(odbc);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("query");
while(rs.next()){
//do something with the information
//make recursive
connection.commit();
myfunction(odbc,data1,data2);
statement.close();
connection.close();
}Hope you can help me!
Feel free to email me at [email protected]
Regards!I am not really sure what the question is but...
Presuming that there isn't something wrong with your design (which recursive calls suggest) then you need to extract all of the data, close the resultset/statement then do the recursive calls. If you do processing first then you can still commit on the connection. -
I've used recursive functions with other programming
languages but I seem to be having a problem using it with a UDF in
a cfc file. I'm reading an XSD file, parsing the XSD and populating
an array with the details of any import tags using XMLSearch,
looping through the array and recursively calling the same UDF to
process the child XSD file, so on an so forth. My issue happens
when the UDF gets to the bottom of the recursive call and is going
back up one level to loop to the next item in the array of the
parent UDF call. When the code returns back it gives me an error
saying "The element at position 2 cannot be found." After some
trouble finding out what is happening, it seems the values
contained in the array have been purged. In my experience with
recursive functions, the values of any past calls will still be
available in memory once the process returns back to it. I'm a
litte green using UDFs but I would think it should work the same
way. Is there an issue with the scope of the array variable I am
using? I've attached my code. Any help is appreciated.
Thanks!If I wanted to keep track of which XSD files I have already
processed,
would I be able to insert the file names into an array or
list across
recursive calls? Would I need to declare it within the
cfcomponent tag
before the cffunction tag? Thanks again.
Yes you can. You would create an array an either the global
THIS
(unfortunately the default) or the more preferred VARIABLES
scope. The
this scope is public, the variables scope is private to the
component.
You can declare this global variable in the "pseudo
constructor" space
at the head of the component - which is the space between the
opening
<cfcomponent> tag and the first opening
<cffunction> tag. You could
also declare this global variable in another initialization
style
function that is called before your iteration function is
called
initially.
You would then access and update the values in the global
variable
inside your iteration function just by calling it as
this.aVariable or
variables.aVariable.
Maybe you are looking for
-
PI 7.11 how to pick up only one file at a time in file adapter
Hi Is there a smart way of only picking up one file at a time (for every poll) in a sender file adapter? E.g. There are 100 files in the source folder but I only want to pick up 1 of the files every time I poll the source folder in my sender file ada
-
I have a new windows 7 pc and i want to move my iTunes mediathek (Music, movies) to it. by using an external driver (Hd.). But On the new pc iTunes does Not integrales the Media files.
-
Share Invitation via Client Object Model
On SharePoint Online Using the "Share" button in the upper right area of the page one can invite a person to join the site. Then the person will get an email and provided the email address is linked to a Microsoft account that person may join the si
-
Is a clean install really this hard?
Hi folks, I installed Flexbuilder 2 over my existing Eclipse installation, choosing the "plug-in" option rather than a complete install. But I couldn't debug: it claimed I had to install FlashPlayer 9 (yes, it was already installed and working) or Fl
-
Hi M.M Team, I noticed that my site can have uneven table cell sizes when viewed in different browsers. IE is good, but Firefox isn't. Is there a way to lock the table sizes please so that this doesn't happen? Thanks Ray