Crash whilst looping through Excel rows
Hi Folks.
I have a program unit in forms which opens an XL spreadsheet and then reads the rows into the DB.
It loops though about 4800 rows and then the whole app dies and forms closes. No error is given.
The code is shown below. If anyone has any suggestions I'd love to hear them.
I have increased the size of the table.
Cheers
Simon
** Module Name :
** Package name :
** Author : Simon Gadd
** Creation Date: 01-NOV-2002
** Called By :
** Calls :
** Description :
** Dev Location :
** Test Location:
** Modification History:
** =====================
** Date Author Description
** ============= =============== ======================================================
PROCEDURE XLSR_CLIENT_NORTM_DATA IS
appID PLS_INTEGER;
convID PLS_INTEGER;
docID PLS_INTEGER;
buffer_1 NUMBER(10);
buffer_2 VARCHAR2(100);
p_pmn CHAR(5);
tap_sequence_no NUMBER(5);
sdr_gross NUMBER(12,3);
next_row NUMBER(4);
next_column NUMBER(4);
last_row NUMBER(4) := 7560;
last_column NUMBER(4);
cell_reference VARCHAR2(10);
app_dir VARCHAR2(100) := 'C:\Program Files\Microsoft Office\Office\Excel.exe';
data_source_dir VARCHAR2(13) := 'C:\FCSS\TEMP';
data_source_file VARCHAR2(21) := 'NIUNORTM0209.xls';
data_source VARCHAR2(50);
dde_commmand VARCHAR2(200);
r VARCHAR2(100);
txt VARCHAR2(20);
err_txt VARCHAR2(100);
a_pmn CHAR(5) := 'NORTM';
valid_nmt BOOLEAN;
BEGIN
-- Clean out any existing data from XLS_C32
DELETE FROM TAP_FILE_DELTA_AP WHERE PMN LIKE '%';
DELETE FROM TAP_FILE_DELTA_AP_ERR WHERE PMN LIKE '%';
COMMIT;
SHOW_STATUS ('Attempting to open Excel');
-- Start exel, load the source file
data_source := data_source_dir||'\'||data_source_file;
dde_commmand := app_dir||' '||data_source;
appID := DDE.App_Begin ( dde_commmand, DDE.APP_MODE_MINIMIZED);
UPDATE_STATUS ('Started Excel ');
-- Initiate a conversation with the source
docID := DDE.INITIATE ('EXCEL',data_source);
UPDATE_STATUS ('Opened source file ');
-- Get the last row to read
--last_row := get_last_cell(docID);
FOR i IN 5 .. last_row LOOP
-- Read the next row
-- IF THE VALUE OF THIS CELL IS A VALID PMN CODE THEN
-- READ THE REST OF THE LINE
-- IF IT IS NOT, RECORD THE LINE NUMBER INTO THE CORRESPONDING ERROR
-- TABLE. USERS NEEDS TO ANALYSE THE ERROR TABLES AND IF REQUIRED
-- UPDATE THE VALID PMN CODES (OPERATORS TABLE)
BEGIN
next_row := i;
err_txt := 'Unable to get data from '||'R'||i||'C3';
DDE.REQUEST(docID, 'R'||i||'C3', buffer_2,DDE.CF_TEXT,10000);
err_txt := 'Unable to translate data';
p_pmn := SUBSTR(buffer_2,1,5);
SHOW_STATUS('Processing ' ||i||' '||p_pmn);
err_txt := 'Unregistered PMN code ?';
valid_nmt := is_the_pmn_valid (p_pmn);
IF (valid_nmt = TRUE) THEN
DDE.REQUEST(docID, 'R'||i||'C3', buffer_2,DDE.CF_TEXT,1000);
p_pmn := SUBSTR(buffer_2,1,5);
err_txt := 'Reading TAP sequence no';
cell_reference := 'R'||i||'C5';
tap_sequence_no := GET_CELL_NUMBER (docID, cell_reference);
err_txt := 'Reading GROSS SDR';
cell_reference := 'R'||i||'C6';
sdr_gross := GET_CELL_NUMBER (docID, cell_reference);
-- ADD DATA TO TABLE TAP_FILE_DELTA_AP
INSERT INTO TAP_FILE_DELTA_AP
VALUES
a_pmn, -- VC2(5)
p_pmn, -- VC2(5)
tap_sequence_no,-- NUM(10)
sdr_gross, --NUM(12,3)
NULL,
NULL
COMMIT;
-- let the user know what is going on
r := 'Row '||i||' > '||p_pmn;
SHOW_STATUS (r);
ELSE
INSERT INTO TAP_FILE_DELTA_AP_ERR
VALUES
a_pmn,
p_pmn,
err_txt
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
INSERT INTO TAP_FILE_DELTA_AP_ERR
VALUES
a_pmn,
p_pmn,
err_txt
COMMIT;
END;
END LOOP;
-- Terminate a conversation with the source
DDE.TERMINATE (docID);
DDE.App_End (appID);
SHOW_STATUS ('Done - Reading');
SHOW_STATUS ('Calculating Differences - Please Wait');
XLSR_CLIENT_NORTM_DATA_PROCESS (a_pmn);
SHOW_STATUS ('Done - Calculating Differences');
END;
Another way is to specify the range in select statement which can be done in two ways
http://getsetsql.blogspot.in/2012/01/using-ssis-load-data-to-excel-sheet-at.html
http://sqlserversolutions.blogspot.in/2009/02/selecting-excel-range-in-ssis.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
Similar Messages
-
Crash whilst looping through Excel spreadsheet
Hi Folks.
I have a program unit in forms which opens an XL spreadsheet and then reads the rows into the DB.
It loops though about 4800 rows and then the whole app dies and forms closes. No error is given.
The code is shown below. If anyone has any suggestions I'd love to hear them.
I have increased the size of the table.
Cheers
Simon
** Module Name :
** Package name :
** Author : Simon Gadd
** Creation Date: 01-NOV-2002
** Called By :
** Calls :
** Description :
** Dev Location :
** Test Location:
** Modification History:
** =====================
** Date Author Description
** ============= =============== ======================================================
PROCEDURE XLSR_CLIENT_NORTM_DATA IS
appID PLS_INTEGER;
convID PLS_INTEGER;
docID PLS_INTEGER;
buffer_1 NUMBER(10);
buffer_2 VARCHAR2(100);
p_pmn CHAR(5);
tap_sequence_no NUMBER(5);
sdr_gross NUMBER(12,3);
next_row NUMBER(4);
next_column NUMBER(4);
last_row NUMBER(4) := 7560;
last_column NUMBER(4);
cell_reference VARCHAR2(10);
app_dir VARCHAR2(100) := 'C:\Program Files\Microsoft Office\Office\Excel.exe';
data_source_dir VARCHAR2(13) := 'C:\FCSS\TEMP';
data_source_file VARCHAR2(21) := 'NIUNORTM0209.xls';
data_source VARCHAR2(50);
dde_commmand VARCHAR2(200);
r VARCHAR2(100);
txt VARCHAR2(20);
err_txt VARCHAR2(100);
a_pmn CHAR(5) := 'NORTM';
valid_nmt BOOLEAN;
BEGIN
-- Clean out any existing data from XLS_C32
DELETE FROM TAP_FILE_DELTA_AP WHERE PMN LIKE '%';
DELETE FROM TAP_FILE_DELTA_AP_ERR WHERE PMN LIKE '%';
COMMIT;
SHOW_STATUS ('Attempting to open Excel');
-- Start exel, load the source file
data_source := data_source_dir||'\'||data_source_file;
dde_commmand := app_dir||' '||data_source;
appID := DDE.App_Begin ( dde_commmand, DDE.APP_MODE_MINIMIZED);
UPDATE_STATUS ('Started Excel ');
-- Initiate a conversation with the source
docID := DDE.INITIATE ('EXCEL',data_source);
UPDATE_STATUS ('Opened source file ');
-- Get the last row to read
--last_row := get_last_cell(docID);
FOR i IN 5 .. last_row LOOP
-- Read the next row
-- IF THE VALUE OF THIS CELL IS A VALID PMN CODE THEN
-- READ THE REST OF THE LINE
-- IF IT IS NOT, RECORD THE LINE NUMBER INTO THE CORRESPONDING ERROR
-- TABLE. USERS NEEDS TO ANALYSE THE ERROR TABLES AND IF REQUIRED
-- UPDATE THE VALID PMN CODES (OPERATORS TABLE)
BEGIN
next_row := i;
err_txt := 'Unable to get data from '||'R'||i||'C3';
DDE.REQUEST(docID, 'R'||i||'C3', buffer_2,DDE.CF_TEXT,10000);
err_txt := 'Unable to translate data';
p_pmn := SUBSTR(buffer_2,1,5);
SHOW_STATUS('Processing ' ||i||' '||p_pmn);
err_txt := 'Unregistered PMN code ?';
valid_nmt := is_the_pmn_valid (p_pmn);
IF (valid_nmt = TRUE) THEN
DDE.REQUEST(docID, 'R'||i||'C3', buffer_2,DDE.CF_TEXT,1000);
p_pmn := SUBSTR(buffer_2,1,5);
err_txt := 'Reading TAP sequence no';
cell_reference := 'R'||i||'C5';
tap_sequence_no := GET_CELL_NUMBER (docID, cell_reference);
err_txt := 'Reading GROSS SDR';
cell_reference := 'R'||i||'C6';
sdr_gross := GET_CELL_NUMBER (docID, cell_reference);
-- ADD DATA TO TABLE TAP_FILE_DELTA_AP
INSERT INTO TAP_FILE_DELTA_AP
VALUES
a_pmn, -- VC2(5)
p_pmn, -- VC2(5)
tap_sequence_no,-- NUM(10)
sdr_gross, --NUM(12,3)
NULL,
NULL
COMMIT;
-- let the user know what is going on
r := 'Row '||i||' > '||p_pmn;
SHOW_STATUS (r);
ELSE
INSERT INTO TAP_FILE_DELTA_AP_ERR
VALUES
a_pmn,
p_pmn,
err_txt
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
INSERT INTO TAP_FILE_DELTA_AP_ERR
VALUES
a_pmn,
p_pmn,
err_txt
COMMIT;
END;
END LOOP;
-- Terminate a conversation with the source
DDE.TERMINATE (docID);
DDE.App_End (appID);
SHOW_STATUS ('Done - Reading');
SHOW_STATUS ('Calculating Differences - Please Wait');
XLSR_CLIENT_NORTM_DATA_PROCESS (a_pmn);
SHOW_STATUS ('Done - Calculating Differences');
END;What version of POI are you using? Have you tested using the latest version?
Try modifying to put just plain text. So instead of setCellValue(new HSSFRichTextString(patientCount));do something like this:
cellOne.setCellValue("test1");
cellTwo.setCellValue("test2");If the above works then try:
setCellValue(patientCount);Then if the two above steps work, try this:
setCellValue(new HSSFRichTextString("test1"));If all the above work, then I'd be interested to see what the value of patientCount is.
It's possible that HSSFRichTextString is causing some sort of issue..Maybe with the object itself or with data that resides in it. And maybe creating a cell after really finishes the previous cell. I know it technically doesnt make sense, but i've seen wierd things like that before :) -
How Do I get SSIS To Stop Looping Through Excel Rows After Last Populated Record?
I have a package that loops through many excel files. Each Excel File has about 5000 rows. My problem is that after the 5000th row SSIS keeps looping through all the rows after the last row. There are nothing in these rows. This is a complete bottleneck
of my package because it takes forever when doing this. How do I stop this?
ThanksAnother way is to specify the range in select statement which can be done in two ways
http://getsetsql.blogspot.in/2012/01/using-ssis-load-data-to-excel-sheet-at.html
http://sqlserversolutions.blogspot.in/2009/02/selecting-excel-range-in-ssis.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
JDev 10.1.3.4: How to properly loop through the rows of a VO?
Hi,
This is a newbie question. Using JDeveloper 10.1.3.4 I am trying to loop through the rows of a view object. I am sure that the VO returns the following rows in that order:
200809
200902
200906If I use this code (where termsOpen is the VO instance):
while (termsOpen.hasNext()) {
System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
}it proves to be an endless loop and I get "200809" printed on the console endlessly. The API says that hasNext() "does not move the current row". A book says that the pointer initially is at row 0. I wonder why it prints the first row. So the code is changed to:
while (termsOpen.hasNext()) {
Row currRow = termsOpen.next();
System.out.println(currRow.getAttribute("Term"));
}But now I get only the last two rows printed on the console, and do not get to see the first row:
200902
200906What's wrong?
Thanks for helping!
NewmanHi, Branislav,
Thank you for the suggestion.
I tried that also. When the code is
while (termsOpen.hasNext()) {
System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
termsOpen.next();
}I get only the first two rows and last row is dropped:
200809
200902To get all the three row, I end up using this code:
System.out.println(termsOpen.first().getAttribute("Term"));
while (termsOpen.hasNext()) {
Row currRow = termsOpen.next();
System.out.println(currRow.getAttribute("Term"));
}But that shouldn't be the way of doing the work. If I use a block of 50 lines of code to process each row, the code will have to be written once before the while loop and another time inside the while loop.
The book which says that the pointer starts at the row slot before the first row is found on the internet, on p.469. It makes sense to me that the pointer starts at row 0. But unfortunately the actual copy of JDev 10.1.3.4 I am using behaves otherwise.
Newman -
Loop Through Excel Files and Load into SQL Server Table
I'm following the example here.
https://www.youtube.com/watch?v=_B83CPqX-N4
I'm pretty sure I did all the steps, but for some reason my project is not running. I'm thinking there is a 32-bit or 64-bit issue lurking in here somewhere.
Here's my error message.
SSIS package "C:\Users\Ryan\Documents\Visual Studio 2010\Projects\Loop through Multiple Excel sheets and load them into a SQL Table\Integration Services Project1\Package.dtsx" starting.
Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning.
Error: 0xC0209303 at Package, Connection manager "Excel Connection Manager": The requested OLE DB provider Microsoft.ACE.OLEDB.12.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".
Error: 0xC001002B at Package, Connection manager "Excel Connection Manager": The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
For more information, see http://go.microsoft.com/fwlink/?LinkId=219816
Error: 0xC020801C at Data Flow Task, Excel Source [2]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303.
There may be error messages posted before this with more information on why the AcquireConnection method call failed.
Error: 0xC0047017 at Data Flow Task, SSIS.Pipeline: Excel Source failed validation and returned error code 0xC020801C.
Error: 0xC004700C at Data Flow Task, SSIS.Pipeline: One or more component failed validation.
Error: 0xC0024107 at Data Flow Task: There were errors during task validation.
SSIS package "C:\Users\Ryan\Documents\Visual Studio 2010\Projects\Loop through Multiple Excel sheets and load them into a SQL Table\Integration Services Project1\Package.dtsx" finished: Failure.
The program '[5392] DtsDebugHost.exe: DTS' has exited with code 0 (0x0).
I have 32-bit Excel and 64-bit SQL Server. Is that the issue? Can someone tell me what's wrong here?
Thanks!!
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Sa-weeettttttt!! Thanks. I figured that's what it was. For the benefit of others, this link shows you exactly how to make the modification recommended above.
http://help.pragmaticworks.com/dtsxchange/scr/FAQ%20-%20How%20to%20run%20SSIS%20Packages%20using%2032bit%20drivers%20on%2064bit%20machine.htm
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
Best way to loop through multiple rows to search for a count result
I have a script where I'm trying to find a Rollup row without any children. I have created a SQL statement to do this, but I can only input one point at a time. If the count is greater than 0 then i'm good to go. If the count is 0 then I want to know about it.
select count (*) from (Select * From ESSBASE_FCS.Ham
where hier_pt like (Select substr(hier_pt, 1,8)||'%' as hcy_pt
From ESSBASE_FCS.Ham
Where Hier_Pt = '412375....')
And Cctr_Or_Rollup 'Rollup')
What is the best way to develop a SQL script that searches through all my Hier_pt's and return everything with a count of 0, instead of manually inputing each hier_pt at a time?
Thanks for any help.Hi,
Please read SQL and PL/SQL FAQ
Please provide table structure, sample data and expected output.
Additionally when you put some code please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
I noticed also that you have posted the same question here: {message:id=10678000}
If you move your question to another forum please mark the previous question as answered.
Regards.
Al
Edited by: Alberto Faenza on Nov 7, 2012 5:03 PM -
Hi all,
I have a requirement in oaf. I have created a Master detail sort of web page. Based on ceratin search fields the results table gets populated. Now this result table has check box on each row. When ever the user checks the check bow for say row1 and 5, those Shipment_Id (included in the VO) should be passed to a pl/sql pkg.
I am trapping the event in CO and passing the prameter to the AM wher the pkg.proc is called to which this parameter is passed. But I need to get only those row's ID for which the check box is checked. How do I achieve this? Pls do pass the sample code if any.I made the changes:
public void Acknowledge()
OAViewObject vo = getAsnVO1();
int fetchedRowCount = vo.getFetchedRowCount();
RowSetIterator selectIter = vo.createRowSetIterator("selectIter");
if (fetchedRowCount > 0)
// Save the original range size and range start.
selectIter.setRangeStart(0);
selectIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
AsnVORowImpl rowi = (AsnVORowImpl)selectIter.getRowAtRangeIndex(i);
String selectFlag = rowi.getSelectFlag()+"";
String ShipmentLineId1=rowi.getShipmentLineId;
if("Y".equals(selectFlag))
// Getting selected row.
System.out.println("inside AM submit request method ");
System.out.println("*********calling pl/sql prog**************");
CallableStatement st = null;
try
String stmt ="begin pkg.proc(p_supply_source_id =>"+ShipmentLineId1"+); end; ";
OADBTransaction tr = getOADBTransaction();
st = tr.createCallableStatement(stmt, 1);
st.close();
OAExceptionUtils.checkErrors(tr);
catch(SQLException sqle)
throw OAException.wrapperException(sqle);
selectIter.closeRowSetIterator();
Error(175,100): ';' expected
Error(163,29): variable getShipmentLineId not found in class xx.oracle.apps.bps.asn.server.AsnVORowImpl
Line: 175 is String stmt ="begin xxbp_del_from_supp_pkg.Delete_Mtl_Supply(p_supply_source_id =>"+ShipmentLineId1"+); end; ";
Line 163 is :
String ShipmentLineId1=rowi.getShipmentLineId;
In my Vorowimpl i have that getshipmnetlineid, stil getting that error.
* Gets the attribute value for the calculated attribute ShipmentLineId
public String getShipmentLineId()
return (String)getAttributeInternal(SHIPMENTLINEID);
Actually it is a number. But in my VO it is a string. That should not be a prob i guess. -
I need help writing a excelmacro to do a copy of 4 cells and paste transpose. I need to loop the copy and paste through 6900 rows of data. I started the macro with two rounds of copying & paster transposed but I need help getting it
to loop through all rows. Here is what macro looks like now.
Range("I2:I5").Select
Application.CutCopyMode = False
Selection.Copy
Range("J2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Range("I6:I9").Select
Application.CutCopyMode = False
Selection.Copy
Range("J6").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End SubThanks Jim for the solution above.
Hi Brogents,
Thanks for posting in our forum. Please note that this forum focuses on questions and feedback for Microsoft Office client. For any
VBA/Macro related issues, I would suggest you to post in the forum of
Excel for Developers, where you can get more experienced responses:
https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Ethan Hua
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
How to loop through xml records from file without ROW , /ROW tags?
I am using dbms_XMLSave.insertXML procedure to insert xml formated record from file. MY xmlformated records does not have open and close ROW tags. I have multiple records in the file.How can I loop through without <ROW>,</ROW> tags?
I am using dbms_XMLSave.insertXML procedure to insert xml formated record from file. MY xmlformated records does not have open and close ROW tags. I have multiple records in the file.How can I loop through without <ROW>,</ROW> tags?
-
Loop Through Rows in SQL Report.
Hello Everyone,
I've been creating a very different application, and I've run into quite the roadblock.
Let me give you a breif about the problem.
I have a form that needs to be dynamic and thus is created at runtime.
I have used the APEX_ITEM and a SQL SELECT CASE to create a dynamic report.
For example if the DATATYPE column in my table says DATE, I create an APEX_ITEM.DATE_POPUP, if it says CHAR i create a textbox, and if a column called
LOV is populated APEX_ITEM.SELECT_LIST_FROM_QUERY using the number value of the LOV to query a List of Values from another table.
Now this brings me to say in a single column of the there could be different data_types. meaning the multi-row update functionality with apex will not work.
Getting the data to display is easy. However saving the updates is a different story.
Which brings me to my question. Does anybody know of way in which you can loop through each row in a SQL Report on APEX and assess each row individually.
I'd like to accomplish something like this
LOOP
MyUpdateProcedure(currentrow_id,currentrow_datatype, currentrow_value)
Go to Next Row in Report
END LOOP;
Pretty simple in theory? Do we have an APEX expert out there who could give me a hand with this?Codes,
It sounds to me like you could add a hidden field to tell you what you need to know in order to determine the column to update.
Assuming it was created using the parameter p_idx = 50 and contained the names you provided (eg DATA_DATA) and your primary key is created using p_idx = 1 then you could add the logic for the update into an on submit process something like so
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
CASE apex_application.g_f50(i)
WHEN 'DATA_DATA' THEN
-- run the update against the data column
WHEN 'CHAR_DATA' THEN
-- run the update against the char column
etc.
If the multi-type column is created with the apex_item api using p_idx = 2 then you just refer to it in the loop as apex_application.g_f02(i) and the primary key is apex_application.g_f01(i).
I hope this helps.
Greg -
How to loop through classic report rows?
Hi,
I have a page that has a classic report region. Can I somehow loop through the rows in the report result?
If I put a checkbox item in the query then using this works fine, but I would not like to add checkbox I just would like to loop through the records.
FOR I in 1..APEX_APPLICATION.G_F02.COUNT LOOP
Do something with record having checkbox item value APEX_APPLICATION.G_F02(i);
END LOOP;
TIA,
TamasAndy,
What I would like to do is to let the user click a report row, then navigate to a detail form page and display detailed information of the given report row. And should the suer decide to have a look at all the records, then let him/her click a next button on the detail form and display the next row in the report result on the detail form.
Thanks for the tip. if there is no other way, I will probably do this way.
Tamas -
How to loop through rows in datatable?
Hi,
I have a datatable component with a few columns bound to a database table but I have also added a new textfield column to the datatable. The purpose of this datatable is to present the user with a list of products from the database and then allow the user to enter a quantity value into the textfield for each product (ie datatable row).
This all works fine until i need to capture the quantity values the user has entered. It seems the datatable component can only provide the current row details. However what I want to do is when the user finishes entering the quantities for all the products they click a button and then I loop through each row in the datatable from start to end and find out what quantities were entered for each product.
I can find no documentation or threads on how to do this. It seems like a very basic concept but perhaps is not possible to achieve. Can anyone help?
Also I entered a default value of "0" in the value expression (ie text) property of the new textfield in the datatable but this value never appears (ie the textfields are always empty). However the text property seems to work ok for normal textfield components not within a datatable. Any ideas?
Thanks.thanks, I am able to iterate through the datatable rows now and get the values, however I still have one (actually two) big problem...
1. I cannot get the textfields to be prepopulated with a value when the page first loads. I have the text property of the textfield set to a value but this makes no difference, the textfields are always blank.
2. After a user enters values and clicks the button to calculate the page reloads and again all entered values are gone (ie the damn textfields are empty again). Is this normal behaviour for textfields within a datatable....surely not.
So, I added some code to my prerender method to specifically populate the textfields and although it loops through each textfield only the last textfield gets populated. I cannot work this one out. Datatables should be easy to work with, but like most things Creator turns an easy job into an impossible one.
Please help. -
Hi,
I want to loop through each column of a CSV file.
And while looping each column, I want to loop each row
starting with the 2st row.
I wrote the code as below, but it is looping through the rows
starting from row 1.
How do I make it start the loop as from row 2 in the CSV ?
(see code below)
Can someone tell me how to do this?
Thx
<!--- get and read the CSV-TXT file --->
<cffile action="read" file="C:\Documents and
Settings\user\Desktop\EM-CSV\test.csv" variable="csvfile">
<!--- loop through the CSV-TXT file on line breaks and
insert into database --->
<table border="1">
<cfloop index="index" list="#csvfile#"
delimiters="#chr(10)##chr(13)#">
<!--- <cfoutput>#listgetAt('#index#',1,
',')#</cfoutput><br> --->
<tr>
<td><cfoutput>#index#</cfoutput></td>
<td><cfoutput>#listgetAt('#index#',2,
',')#</cfoutput></td>
<td><cfoutput>#listgetAt('#index#',3,
',')#</cfoutput></td>
</tr>
</cfloop>
</table>Hello, your code works perfectly.
Now I am having a slight problem with it.
I have added the code to check whether a particular cell of
the CSV is blank. (see code below)
But it is giving me error message.
Can you please tell me what am doing wrong?
Thx
<!--- loop through the CSV-TXT file on line breaks and
insert into database --->
<cfset isRowTwoOrLater=false>
<table border="1">
<cfloop index="row" list="#csvfile#"
delimiters="#chr(10)##chr(13)#">
<cfif isRowTwoOrLater>
<tr>
<cfif #listgetAt(row,1, ',')# neq ''> <!--- I HAVE
ADDED THIS PART TO CHECK WHETHER IT IS BLANK --->
<td><cfoutput>#listgetAt(row,1,
',')#</cfoutput></td>
<cfelse>
<td><cfoutput>It is
blank</cfoutput></td>
</cfif>
<td><cfoutput>#listgetAt(row,2,
',')#</cfoutput></td>
<td><cfoutput>#listgetAt(row,3,
',')#</cfoutput></td>
</tr>
<cfelse>
<cfset isRowTwoOrLater = true>
</cfif>
</cfloop>
</table> -
Facing issue with for each loop in excel VBA
Hi,
I am using VBA .
I am looping through each row and the column matches value,I am getting the value of G column with the selected row.
Dim selectedCell As Range
Dim weekMinutes As Double
Dim rowNumber As Integer
usageTracking.Activate
weeklySheetName = sheetName
For Each selectedCell In ActiveSheet.Range("A:A")
If selectedCell.Value = customerName Then
' weekMinutes = ActiveSheet.Range("G" & (selectedCell.row)).Value
weekMinutes = Cells(selectedCell.row, "G").Value
End If
Next selectedCell
I am able to get value for the first row.
from second row,even though i am having different value,the "weekMinutes" value is showing as 0 instead of the value in the cell.
whats wrong I am doing.Hi AjayChigurupati,
The code seems ok, and I also made a quick test. It works well for me.
Please check the value in A column, the weekMinutes variable only was assigned when the value in column A is equal customerName.
I also suggest that you loop the UsedRange in Column A to improve the preformance.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How do I Loop through a recordset using PHP
I have a recordset containing a MySql table with 5 columns, each one containing an email address of an official in a club.
Each row represents a different club, and each column a different type of official.
The first column represents chairmen, the next treasurers etc...
The recordset is called $mailset.
I need to loop through each row of $mailset and extract the email addresses of each column and concatenate them into a string seperated by semi colons ; so it ends up like this:
[email protected];[email protected];[email protected]; and so on.
This is how the recordset is set up:
mysql_select_db($database_dummyread, $dummyread);
$query_mailset = "SELECT club_chair_email, club_treas_email, club_sec_email, club_delegate_email, club_deputy_email FROM clubs";
$mailset = mysql_query($query_mailset, $dummyread) or die(mysql_error());
$row_mailset = mysql_fetch_assoc($mailset);
$totalRows_mailset = mysql_num_rows($mailset);
?>
I tried using a loop to step through the recordset, but it always shows the first record, so its not moving the pointer through the file.
The pseudo code aught to be something like this:
Initialise variables and move to the first record
If there are records to process
Read a record
Process all columns
Move on to the next record
else
if there are no records
print an error message
else
Print the results.
Can anyone give me a hint as to how to move from row to row in a recordeset under the control of a loop.
I am using PHP and MySql. (as far as I know, it is the original - not PDO or MySqli)Each call to mysql_fetch_assoc($mailset) retrieves the value at the current location and increments the pointer in the recordset array. So use either a do or while loop and call mysql_fetch_assoc($mailset) from within the loop.
From the docs:
Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.
Maybe you are looking for
-
Hey I have several problems with my iPhone, all of which i would have thought would dissappear as Apple updated the firmware, but it hasn´t so far. My problems are that the keyboard is lagging every fifth time that I use it, the letters appear about
-
Modal Dialog won't close before tasks complete..
Hi all, Basic, but quite infuriating problem. Because Illustrator doesn't allow palette type windows, nothing can happen whilst the dialog is open. So, I've been using scripts I wrote over six months ago now for producing sets of scale elevations of
-
Imp Tcodes n Tables in HR module
Hi Earlier i have worked with SD,MM, and FI modules but right now im into a project which involves HR module.As im new to HR module n wants to know what r all the imp transactions and tables in HR module. Also my first obejct is involved with creatio
-
I can see there is a automated backup for exchange databases. Can we change the schedule ? Its running on busy production time which i need to change ? Have anyone try this ? How to change/view or modify ? UMESH DEUJA MCP,MCTS,MCSA,CCNA
-
Over Head on Subcon PO for Varaint Configuration Part
Hi, We have scenario where we issue the PO to Subcontractor for part which is F-30 ( Procurement Type in Material Master - Subcontract) and has Varaint Configuration. Requirement -While doing the GR against the PO need to calculate fixed OverHead and