create a txt file
Hello
I want to send 30 recordings with slider & for loop & UTL_FILE in txt file with 9. I can write all records in a single file.
30 records == > 1-9 record 1 file
10-18 2nd files
18-27 3rd files
27-30 4th records
Is this possible?
Here is an example. In the code below, the code highlighted in red will be your actual query that retrieves the data. He ROW_NO, FILE_NO and MAX_RNO are the values that I generated to create a separate file for each 9 entries.
SQL > declare
l_file 2 utl_file.file_type;
3. start
4 for i in)
5 Select mod row_no (rownum-1: 9)
6, ceil(rownum/9) file_no
7, max (mod (rownum-1: 9)) on (ceil(rownum/9) partition) max_rno
8, object_name
object 9
10 where rownum<=>=>
11 order of 2, 1
12 )
loop 13
14 if i.row_no = 0 then
15 l_file: = utl_file.fopen
16 (
17 "KARDIR.
18 , 'file_' || i.file_no | '_' || TO_CHAR (sysdate, 'ddmmyyyyhh24miss'). ".dat".
19 , 'a'
20 );
21 end if;
22
23 utl_file.put_line (l_file, i.object_name);
24
25 if i.row_no = i.max_rno then
26 utl_file.fclose (l_file);
27 end if;
28 end of loop;
29 end;
30.
PL/SQL procedure successfully completed.
% ls - lrt file_ knani * _ * .dat | AWK '{print $9} ' | XARGS wc-l
9 file_1_08072013091853.dat
9 file_2_08072013091853.dat
9 file_3_08072013091853.dat
3 file_4_08072013091853.dat
total of 30
knani %
Tags: Database
Similar Questions
-
create a txt file in the client machine
Hi all
I have
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
AMT for Linux: release 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
I want to create a file in my pc with utl_file for example
{
CREATE OR REPLACE PROCEDURE HELLOFLE IS
v_MyFileHandle UTL_FILE. TYPE_DE_FICHIER;
BEGIN
v_MyFileHandle: = UTL_FILE. FOPEN ("C:------',' myfile.") TXT', 'w');
UTL_FILE. Put_line (v_MyFileHandle, "something must printed");
UTL_FILE. FCLOSE (v_MyFileHandle);
EXCEPTION
WHILE OTHERS THEN
DBMS_OUTPUT. PUT_LINE ('ERROR' |) TO_CHAR (SQLCODE) | SQLERRM);
NULL;
END;
}
could you please help me, I'm new.
Thank you
HiteshYour code looks OK and also fine requirement. You can create a text file on your PC, if you are working on the server or client.
It works fine without any problems abs. The only thing to be supported is the path of directory and file mode.1 directory path - it must be created on the Oracle server, pointing to the location of the target file you. If target is the customer, you must use the name of the computer and the relative path to create the directory as below. If your machine name is CLIENT001 and the target location is C:\Test, then your directory must be on the server (as sysdba)
conn uname/pass as sysdba create directory mydir as '\\CLIENT001\TEST\'
Because file access operations are supported by the server, so the server must have read/write access on the directory path. In the direct words, target your path on the cleint must be shared for access to the R/W server.
Also grant read, write on directory access to the user who executes the procedure UTL_FILE.2. If you want to create a new file on the location of the target file, it must be open in write mode (w) only. You have already done, which is correct.
That thing you can change is the directory in your code and move forward. It should work properly
CREATE OR REPLACE PROCEDURE HELLOFLE IS v_MyFileHandle UTL_FILE.FILE_TYPE; BEGIN v_MyFileHandle := UTL_FILE.FOPEN('C:\','myfile.TXT','w'); UTL_FILE.PUT_LINE(v_MyFileHandle,'some thing should printed '); UTL_FILE.FCLOSE(v_MyFileHandle); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR ' || TO_CHAR(SQLCODE) || SQLERRM); NULL; END;
-
Create a TXT file with header &; trailer from the existing report
Can someone show me please how to get Application APEX to spit a .txt file which will have a header and information as well as the report. Working on a project where the information is entered on the APEX and the report is unloaded in a specific format in notebook must be downloaded into the SAP.
Looking for a better automated way to do it. See the example below. the first line is at the head of the column, is then the header, then the body (report) and finally the trailer down.
Note: the information header and trailer are pre-formatted text and calculations.
Thank you
Document Date reference invoice number freight
H _NONPOTEST 02092006 NONPOINV
05012005 E02082006bb.00.00 103200
05012005 E02082006bb.00.00 103200
05012005 E02082006bb.00.00 103200
05012005 E02082006cc.00.00 239801
NONPOTEST T 6 3000.00It will NOT work as a report of the APEX. You are bypassing the bu report generator this. If you want to build this using Report Designer, then you will need to redefine what you're after, given that the report generator is NOT default to the creation of text files... He can build a CSV file based or PDF with the right software installed on your server...
Thank you
Tony Miller
Webster, TXPublished by: Tony Miller 24 Sep, 2010 14:55
-
Create a txt file-based charater
Have a text file separated by tabs with the definitions of charater style there want to create, but in the name of some policies, it gets error (example Lucida Math Std and Frutiger LT Std.
The file has been exported in the same way, so y don't undestand why. can someone help me pleeeeeaaaase!
Here is the file:
Nome Cast iron Horizontal scale Vertical scale COR % of co Vertical offset Linguagem Basedo em vverbete.lexeger.exeger.tbreg Helvetica LT Std Light Condensed 100 100 C = 0 M = 70 Y = 0 K = 0 100 0 Portuguese: Orthographic agreement [None] efaux3 Helvetica LT Std Roman 100 100 C = 100 M = 0 Y = 0 K = 60 100 0 Portuguese: Orthographic agreement [None] efaux4 Lucida Math Std Symbol 100 100 C = 20 M = 100 Y = 50 K = 0 100 0 Portuguese: Orthographic agreement [None] vverbete. Divisao.catgram.ACEPs.NUM ITC Novarese Std "BOLD" 100 100 C = 0 M = 100 Y = 100 K = 0 100 0 Portuguese: Orthographic agreement [None] vverbete. Divisao.catgram.ACEPs.subacep.traduz.trad_i Frutiger LT Std 46 light Italic 100 100 C = 100 M = 0 Y = 0 K = 20 100 0 Portuguese: Orthographic agreement [None] vverbete. Divisao.catgram.ACEPs.subacep.traduz.trad_ib Frutiger LT Std 66 bold Italic 100 100 C = 100 M = 0 Y = 0 K = 50 100 0 Portuguese: Orthographic agreement [None] Here's the script:
main();
main() {} function
var myObject;
Ensure that the interaction of the user (dialog boxes display, etc.) is turned on.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
If (app.documents.length > 0) {}
myCreateStyles (app.documents.item (0));
}
else {}
Alert ("não existem documents abertos. Abra o pretendido documento e o novo script corra. ») ;
}
}
function myCreateStyles (myObject) {}
var myScriptFileName, myCharFile, myFindChangeFileName, myScriptFile, ditto;
var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit, monarticle;
var myStartCharacter, myEndCharacter;
var myCharFile = myFindFile("/FindChangeSupport/FindChangeList.txt")
var i = 0;
If (myCharFile! = null) {}
myCharFile = File (myCharFile);
myDoc = app.documents var [0];
Ditto var = myCharFile.open ("r", not defined, undefined);
if(myResult == true) {}
Determina o number of styles a criar an alterar
var myCharStyles = new Array();
{}
myFindArray = myCharFile.readln ();
myCharStyles.push (myFindArray);
}
while(myCharFile.EOF == false);
var charStylesLenght = myCharStyles.length;
Estilo shouted a caráter lingua back styles of
for (oneStyle = 1; oneStyle < charStylesLenght; oneStyle ++) {}
var myCharacterStyle = new Array();
myCharStyleProp = myCharStyles [oneStyle] .split ("\t");
var myCharStyleName = myCharStyleProp [0];
var myCharStyleFont = myCharStyleProp [1];
var myCharStyleFontStyle = myCharStyleProp [2];
myCharacterStyle = myDoc.characterStyles.add ();
myCharacterStyle.name = myCharStyleName;
myCharacterStyle.fontStyle = myCharStyleFontStyle;
myCharacterStyle.appliedFont = myCharStyleFont;
}
Alert ("down criados os caráter styles.");
}
}
}
function myFindFile (myFilePath) {}
var myScriptFile = myGetScriptPath();
var myScriptFile = File (myScriptFile);
var myScriptFolder = myScriptFile.path;
CheminMonFichier = myScriptFolder + CheminMonFichier;
If (queue (CheminMonFichier) .exists == false) {}
CheminMonFichier = File.openDialog ("Selecione o documento .txt com as palavras an alterar.");
}
Return CheminMonFichier;
}
function myGetScriptPath() {}
try {}
myFile = app.activeScript;
}
{catch (MyError)}
myFile = myError.fileName;
}
return myFile;
}
If that does not work, try to put the fonts in the folder of the OS (Windows\Fonts on MS Win or ~/Library/Fonts) fonts
-
Can I create a .txt file in flash?
Hello.
I need to create, physically on the file .txt, .xml or server. Flash can generate from these files? I need to get out on the server after the creation.
Thank you.you will need to use the script server-side, in addition to flash.
-
Creating new .txt, in DW CC .sql files
Older versions of DW enabled allows you to create a greater variety of new files, including those with .txt and .sql files types. I like to keep a folder called DB Backup in which I store a recent copy of the database as well as some optional html that I store as .txt files to avoid confusion. I tried to add the file type and associating with DW as editor-in-Chief, but they do not appear when I click ctrl + N.
They do not appear in the new file menu, but all you have to do to create a .txt file in your site's record with the .txt extension. From there on, as long as you open it in the DW, DW files window will be used to change.
-
I want Notepad (txt file) for android
Y at - it an android application create the txt file, where I can transfer them to my computer windows XP laptop and open the same file.
Hello
I suggest you to send your query to the following link:
-
Hi all
Instead of data and using a database in my application, I use the txt files, when the application starts for the first time on a customers phone the console States "txt file not found", but the second time the client access the application then the txt files are found are read txt files. If anyone has experienced this problem or maybe similar problems, please help me.
Thank you
Hey all
My app was crashing in my thread user interface and you there for the app is not read / create the txt files the first time the app
-
How to create a text file of apex
Hello.
I have apex 5 user and I need to create a txt file to format a report ANSI classic interactive report or query.
I need a TXT, CSV file because this file allows it to import into another application.
Is it Possible? How?
Thank you!!
Hmm, could be done in a select statement in a variable:
DECLARE l_Clob_Item CLOB;
l_Length NUMBER;
SELECT Col1 | Col2. COL4 IN l_Clob;
l_Length: =.
DBMS_LOB.GETLENGTH( l_Clob);
Next, you need to write code to allow download of the clob machine local users
owa_util.mime_header('application/octet', FALSE );
htp.p('Content-length: ' || l_length);
htp.p('Content-Disposition: attachment; filename="My_text_File"');
owa_util.http_header_close;
wpg_docload.download_file( l_Clob );
apex_application.stop_apex_engine;Something like this should work...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL -
Problems with downloading to a TXT file
I have a procedure that when called creates a .txt file, which is used as a download to another application.
If I run my procedure, the txt file is created, but when I look at the file, it contains the required records, but also information on the page.
See below.
My code is
At the end of the txt file, I see information like thiscreate or replace PROCEDURE mer_fuel_coupon_download_1 IS -- CURSOR c_fuel_coupon IS SELECT A.VIN, A.FIRST_BFG, F.DRIVER_POSITION, A.BFG_NO, C.MAKES MAKE, D.MODEL, A.FRG_NO, E.COLOUR, A.MANUFACTURED_DATE MANUFACTURED, A.DEREG_ON, A.OTHER_VRN NON_BFG_REG_NO, B.VALID_FROM, B.VALID_UNTIL, 'Not Held Anymore' UNREG_FROM, 'Not Held Anymore' UNREG_TO, G.FUEL_TYPE, A.CC, A.FUEL_RATION, H.PERSONAL_NO, I.RANK, H.FIRST_NAME, H.SURNAME, 'Not Held Anymore' HEAD_OF_FAMILY, J.UIN, TO_DATE(H.DATE_OF_BIRTH,'DD-MON-YY') DATE_OF_BIRTH, J.UNIT_NAME, K.BFPO, -- A.ITEM_ID ROWNUM FROM MER_IMPORTED_ITEMS A, MER_VEHICLE_OWNERSHIPS B, MER_MAKES C, MER_MODELS D, MER_COLOURS E, MER_DRIVER_POSITION F, MER_FUEL_TYPE G, MER_PERSONS H, MER_RANKS I, MER_UNITS J, MER_BFPO K WHERE H.PERSONAL_ID(+) = B.PERSONAL_ID AND B.ITEM_ID(+) = A.ITEM_ID AND C.MAKE_ID(+) = A.MAKE_ID AND D.MODEL_ID(+) = A.MODEL_ID AND E.COLOUR_ID(+) = A.COLOUR_ID AND F.DRIVER_POSITION_ID(+) = A.DRIVER_POSITION_ID AND G.FUEL_TYPE_ID(+) = A.FUEL_TYPE_ID AND I.RANK_ID(+) = H.RANK_ID AND J.UNIT_ID(+) = H.UNIT_ID AND K.BFPO_ID(+) = J.BFPO_ID AND A.BFG_NO IS NOT NULL AND (A.DEREG_ON IS NULL OR A.DEREG_ON > (SYSDATE - 1826)); -- -- line_of_data VARCHAR2(5000); -- dir_prob EXCEPTION; file_write_done EXCEPTION; -- record_ct NUMBER(6) :=0; output_file VARCHAR2(12) := 'FUEL.TXT'; target_file utl_file.File_Type; -- success_ct NUMBER(6) :=0; fail_ct NUMBER(6) :=0; BEGIN -- Set MIME type owa_util.mime_header( 'application/octet', FALSE ); -- Set name fo file htp.p('Content-Disposition: attachment; filename="FUEL.TXT"'); -- Close the HTTP header owa_util.http_header_close; -- -- BEGIN FOR r_fuel IN c_fuel_coupon LOOP BEGIN line_of_data := r_FUEL.VIN||',' ||TO_CHAR(r_FUEL.FIRST_BFG,'DD/MON/YY')||',' ||r_FUEL.DRIVER_POSITION||',' ||r_FUEL.BFG_NO||',' ||r_FUEL.MAKE||',' ||r_FUEL.MODEL||',' ||r_FUEL.FRG_NO||',' ||r_FUEL.COLOUR||',' ||TO_CHAR(r_FUEL.MANUFACTURED,'DD/MON/YY')||',' ||TO_CHAR(r_FUEL.DEREG_ON,'DD/MON/YY')||',' ||r_FUEL.NON_BFG_REG_NO||',' ||TO_CHAR(r_FUEL.VALID_FROM,'DD/MON/YY')||',' ||TO_CHAR(r_FUEL.VALID_UNTIL,'DD/MON/YY')||',' ||r_FUEL.UNREG_FROM||',' ||r_FUEL.UNREG_TO||',' ||r_FUEL.FUEL_TYPE||',' ||r_FUEL.CC||',' ||r_FUEL.FUEL_RATION||',' ||r_FUEL.PERSONAL_NO||',' ||r_FUEL.RANK||',' ||r_FUEL.FIRST_NAME||',' ||r_FUEL.SURNAME||',' ||r_FUEL.HEAD_OF_FAMILY||',' ||r_FUEL.UIN||',' ||TO_CHAR(r_FUEL.DATE_OF_BIRTH,'DD/MON/YY')||',' ||r_FUEL.UNIT_NAME||',' ||r_FUEL.BFPO||',' --||r_FUEL.ITEM_ID||',' ||r_FUEL.ROWNUM||',' || CHR(13)||CHR(10); -- htp.prn(line_of_data); success_ct := success_ct + 1; EXCEPTION WHEN no_data_found THEN RAISE file_write_done; -- WHEN others THEN fail_ct := fail_ct + 1; END; END LOOP; END; END;
Can someone tell me why it is marking this information on my txt file<head> <title>Fuel Coupon Download</title> <link rel="stylesheet" href="/i/themes/theme_20/theme_3_1.css" type="text/css" /> <link rel="stylesheet" href="/i/bfg_css/j6.css" type="text/css" /> <script type="text/javascript" src="/i/bfg_javascript/jquery/jquery-1.3.2.js"></script> <link rel="stylesheet" href="/i/bfg_javascript/jquery/jqueryui/themes/redmond/jquery-ui-1.7.2.custom.css" type="text/css" /> <script type="text/javascript" src="/i/bfg_javascript/jquery/jqueryui/jquery-ui-1.7.2.custom.js"></script> <script type="text/javascript" src="/i/bfg_javascript/j6_javascript.js"></script> <!--[if IE]><link rel="stylesheet" href="/i/themes/theme_20/ie.css" type="text/css" /><![endif]--> <style> * {font-size: 10pt;font-family: Tahoma,Arial,Helvetica,Geneva,sans-serif}; </style> <script src="/i/javascript/apex_ns_3_1.js" type="text/javascript"></script> <script src="/i/javascript/apex_3_1.js" type="text/javascript"></script> <script src="/i/javascript/apex_get_3_1.js" type="text/javascript"></script> <script src="/i/javascript/apex_builder.js" type="text/javascript"></script> <script type="text/javascript"> <!-- /*Global JS Variables*/ var htmldb_Img_Dir = "/i/"; //--> </script> <link rel="stylesheet" href="/i/css/apex_3_1.css" type="text/css" /> <!--[if IE]><link rel="stylesheet" href="/i/css/apex_ie_3_1.css" type="text/css" /><![endif]--> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body ><form action="wwv_flow.accept" method="post" name="wwv_flow" id="wwvFlowForm"> <input type="hidden" name="p_flow_id" value="111" id="pFlowId" /> <input type="hidden" name="p_flow_step_id" value="388" id="pFlowStepId" /> <input type="hidden" name="p_instance" value="1780009464230900" id="pInstance" /> <input type="hidden" name="p_page_submission_id" value="18077377520018" id="pPageSubmissionId" /> <input type="hidden" name="p_request" value="" id="pRequest" /><div id="t20PageHeader"> <table border="0" cellpadding="0" cellspacing="0" summary=""> <tr> <td id="t20Logo" valign="top"><span style="font-family:Arial; color:#FFFFFF; font-size:18px; white-space:nowrap; font-weight:bold;">Vehicle Licensing Office Application</span><br /></td> <td id="t20HeaderMiddle" valign="top" width="100%"><br /></td> <td id="t20NavBar" valign="top"><br /></td> </tr> </table> </div> <div id="t20BreadCrumbsLeft"></div> <table border="0" cellpadding="0" cellspacing="0" summary="" id="t20PageBody" width="100%" height="70%"> <td width="100%" valign="top" height="100%" id="t20ContentBody"> <div id="t20Messages"></div> <div id="t20ContentMiddle"></div> </td> <td valign="top" width="200" id="t20ContentRight"><br /></td> </tr> </table><table border="0" cellpadding="0" cellspacing="0" summary="" id="t20PageFooter" width="100%"> <tr> <td id="t20Left" valign="top"><span id="t20UserPrompt">ADMIN</span><br /></td> <td id="t20Center" valign="top"></td> <td id="t20Right" valign="top"><span id="t20Customize"></span><br /></td> </tr> </table> <br class="t20Break"/> <input type="hidden" name="p_md5_checksum" value="" /></form> <script type="text/javascript"> <!-- //--> </script><!-- Code generated for user with developer privileges. --> <script type="text/javascript"> function popupInfo() { w = open("f?p=4000:34:1780009464230900:PAGE:NO:34:F4000_P34_SESSION,F4000_P34_FLOW,F4000_P34_PAGE:1780009464230900,111,388","winLov","Scrollbars=1,resizable=1,width=700,height=450"); if (w.opener == null) w.opener = self; w.focus(); } </script><table cellpadding="0" border="0" cellspacing="0" summary="Developer Toolbar" align="center"><tbody><tr><td><a class="htmldbToolbar" href="f?p=4500:1000:1780009464230900" style="border-left:1px solid black;" title="Application Express Home">Home</a></td><td><a class="htmldbToolbar" title="Application 111" href="f?p=4000:1:1780009464230900::NO:1,4150,RP:FB_FLOW_ID,FB_FLOW_PAGE_ID,F4000_P1_FLOW,F4000_P4150_GOTO_PAGE,F4000_P1_PAGE:111,388,111,388,388" style="border-left:1px solid #000000;border-right:1px solid #000000;">Application 111</a></td><td><a class="htmldbToolbar" title="Edit Page 388" href="f?p=4000:4150:1780009464230900::NO:1,4150:FB_FLOW_ID,FB_FLOW_PAGE_ID,F4000_P1_FLOW,F4000_P4150_GOTO_PAGE,F4000_P1_PAGE:111,388,111,388,388">Edit Page 388</a></td><td><a class="htmldbToolbar" href="f?p=4000:336:1780009464230900::::FB_FLOW_ID,FB_FLOW_PAGE_ID,F4000_P1_FLOW,F4000_P4150_GOTO_PAGE,F4000_P1_PAGE:111,388,111,388,388" style="border-left:1px solid black;" title="Create">Create</a></td><td><a class="htmldbToolbar" href="javascript:popupInfo()" style="border-left:1px solid black;" title="Session">Session</a></td><td><a class="htmldbToolbar" href="f?p=4000:14:1780009464230900::::FB_FLOW_ID,FB_FLOW_PAGE_ID,F4000_P1_FLOW,F4000_P4150_GOTO_PAGE,F4000_P1_PAGE:111,388,111,388,388" style="border-left:1px solid black;" title="Activity">Activity</a></td><td><a class="htmldbToolbar" title="Debug" style="border-left:1px solid black;" href="f?p=111:388:1780009464230900::YES">Debug</a></td><td id="hideEdit" style="display:none;"><a class="htmldbToolbar" title="Hide Edit Links" href="javascript:quickLinks('HIDE');" style="border-right:1px solid #000000;border-left:1px solid black;">Hide Edit Links</a></td><td id="showEdit"><a class="htmldbToolbar" title="Show Edit Links" href="javascript:quickLinks('SHOW');" style="border-right:1px solid #000000;border-left:1px solid #000000;">Show Edit Links</a></td></tr></tbody></table> <script type="text/javascript"> if(GetCookie('ORA_WWV_QUICK_EDIT') != null){ if(GetCookie('ORA_WWV_QUICK_EDIT') == 'SHOW') quickLinks('SHOW'); } </script> </body> </html>
See you soon
GusHello
before the call to the exception handler
apex_application.g_unrecoverable_error := true;
Kind regards
Jari -
Can BlackBerry 10 I create new simple text (TXT) file on 10 BB?
Hello - I am using simple *. TXT files in the DropBox folder to create notes and sync with the computer in Linux (via DropBox).
I can't find any method to create a new file to plain text (on sd card, dropbox,... file system folder). I can create document in the Docs To Go, but the document is saved as.doc (document ms).
Edit and resave existing plain text (*.txt) files are pretty simple 'Docs To Go"(no problem).
A tip?
I don't see a way to do it. But I searched the text editor in BlackBerry World and got a lot of possibilities. Some look pretty good.
-
create and write input by the user in a txt file
Hey all
Below, I added a piece of code... I would like to take the data and store it in a txt file as soon as the user clicks on the button field, I tried several times to get this figured out and google it fot too long now. could someone be so kind to help me please?
Thank you
btnRegister = new ButtonField ("Register", ButtonField.CONSUME_CLICK);
customListener = new FieldChangeListener() {}
' Public Sub fieldChanged (field field, int context) {}
Dialog.Alert ("you will receive an email as soon as your account has been activated!");
}
};
Add (btnRegister);
btnRegister.setChangeListener (customListener);
}
store users entry in a txt file, if no txt file, then create one.
{} public void createFile()
System.out.println ("registry"); Screen prints
String data = Username.getText ();
String Data1 = enterPIN.getText ();
data from Byte [] = "Registration".getBytes ();
try {}
FileConnection fconn is (FileConnection) Connector.open (NewRegFileName, Connector.READ_WRITE);.
If (fconn.exists ()) {}
fconn. Delete();
fconn. Create();
System.out.println ("created txtfile");
OutputStream os = fconn.openOutputStream ();
System.out.println ("write data");
OS. Write (Data);
OS. Close();
fconn. Close();
}
}
catch (IOException e) {}
System.out.println ("NewRegFileName" + (Data));
}System.exit(); Quit the application after registration
}
Screen.onClose ();
/ * public boolean onClose() {//Exit application after registration
System.Exit (0);
Returns true;
}*/
Screen.Close (); Quit the application after registration
}When you call createFile()?
-
Create a simple txt file of extendscript.
Run.txt file not created in drive c.?
var myFile = new File("/C/run.txt");
var content = "ABCDEF";
myFile.write (content);
Maybe
var myFile=new File("C:\\run.txt");
?
Also, make sure that the preference of the AE "Allow scripts to write files and access network" is enabled.
-
Dynamically creating DataGrid imported .txt file
I have a tab delimited .txt file exported from Excel which looks like this:
Sector Section the family Brand Image Description price quantity Code
Sector 1 Section 1 Description of the Fiat 10000 1 10000 10000 8 25.00 family
Sector 1 Section 1 1 10001 Kawasaky 10001 Description 10001 10 45.00 family
Sector 1 Section 1 10002 1 Ford 10002 Description 10002 15 10,00 family
Sector 1 Section 1 2 10003 Fiat 10003 Description 10003 100 8.00 family
In this case, I have nine columns, but the method should work with any number of columns.
The code is developed in Flash Builder, but it's especially AS3.
I dynamically create a DataGrid from these values. It's my first attempt:
<? XML version = "1.0" encoding = "utf-8"? >
" < = xmlns:fx s:Application ' http://ns.Adobe.com/MXML/2009 "
xmlns:s = "library://ns.adobe.com/flex/spark".
xmlns:MX = "library://ns.adobe.com/flex/mx".
creationComplete = "creationCompleteHandler (event)" >
< fx:Script >
<! [CDATA]
import flash.net.URLLoader;
import flash.net.URLRequest;
Import mx.collections.ArrayCollection;
Import mx.controls.DataGrid;
Import mx.controls.dataGridClasses.DataGridColumn;
Import mx.events.FlexEvent;
private var loader: URLLoader = new URLLoader();
private var request: URLRequest = new URLRequest("txtData/products.txt");
protected function creationCompleteHandler(event:FlexEvent):void {}
loader.addEventListener (Event.COMPLETE, loader_complete);
Loader.Load (request);
}
protected function loader_complete(evt:Event):void {}
Create array of lines in .txt file loaded
var lines: Array = evt.target.data.split(/\n/);
var dg:DataGrid = new DataGrid();
var columns: Array = [];
var dataProvider:ArrayCollection = new ArrayCollection();
for (var i: Number = 0; i < lines.length; i ++) {}
String: var line = lines [i];
Create array of column values of each row
var lineArray:Array = line.split(/\t/);
for (var j: Number = 0; j < lineArray.length; j ++) {}
var prop: String = lineArray [j];
{if(i==0)}
If the first row of the table, create column and assign the value of prop to dataField
var c:DataGridColumn = new DataGridColumn (prop);
c.dataField = prop;
Columns.push (c);
}
else {}
create the new object and add it to the dataProvider
var dataObject:Object = {area: lineArray [0], Section: lineArray [1], family: lineArray [2], Code: lineArray [3], mark: lineArray [4], Image: lineArray [5], Description: lineArray [6], quantity: lineArray [7], price: lineArray [8]};
dataProvider.addItem (dataObject);
}
}
}
assign columns to the dataGrid control
CGI Columns = columns;
assign the dataProvider of the dataGrid
dg.dataProvider = dataProvider;
Add the DataGrid on stage
this.addElement (dg);
}
[]] >
< / fx:Script >
< / s:Application >
I was able to create columns and dataFields dynamically, instead, I wasn't able to do it for the data provider items (see below):
var dataObject:Object = {area: lineArray [0], Section: lineArray [1], family: lineArray [2], Code: lineArray [3], mark: lineArray [4], Image: lineArray [5], Description: lineArray [6], quantity: lineArray [7], price: lineArray [8]};
How can I create these values dynamically (without knowing the names number and column data area)?
Thanks in advance
use:
If (i == 0) {}
for (var j: int = 0; j
var prop: String = lineArray [j];
var c:DataGridColumn = new DataGridColumn (prop);
c.dataField = prop;
Columns.push (c);
}
} else {}
var dataObject:Object = {};
for (j = 0; j<>
dataObject [columns [j] .dataField] = lineArray [j];
}
dataProvider.addItem (dataObject);
}
-
Create hyperlink text in .txt file
I bought a model for my company's Web site. I change the text (header, body, etc.) in the file .txt (directions from the creator of model to do this). I now have to be part of this text in the .txt file a hyperlink (one to a PDF on my server) and several other sites. When I highlight the text in the .txt file, I give me the ability to create a hyperlink. Of course, when I try to create a hyperlink in code, I can't. The problem is that the desired text only listed in the .txt file.
What can I do? Am I stopped from using text, because all the text is in the .txt file?
Thank you in advance!
(1) open yourfilename.txt.
(2) SaveAs yourfilename.html
(3) this will give you an HTML document, you can work with Design view (though not named).
Add your links to the page. CTRL + S to save.
(4) SaveAs yourfilename.txt.
Nancy O.
ALT-Web Design & Publishing
Web | Graphics | Print | Media specialists
http://ALT-Web.com/
http://Twitter.com/ALTWEB
Maybe you are looking for
-
New owner of smartwatch 3, only about 12 hours of battery life!
Hi, seems that I'm not the problem of battery life only experience on smartwatch 3. Just received the watch last week to use with my Xperia XZ, overall satisfied with the watch but the life of the battery. Expected to last two days, but have misery t
-
will be the record of the partition are removed during the restoration of the system
I tried to do a system reinstall, so I wanted to know if the other partition created by me (IE another dan C will get also deleted/formatted.) thanku in adv
-
I use JDE4.5.0 and Simulator 8120. I use a simple code to make an event logging. Is it possible for me to see what events are recorded by my application. Please note that I'm using a simulator, and I do not have a device. Thank you -FH
-
Reinstalled Windows 7 64 on the new SSD hard drive. Steam downloaded and worked well. Even ran a Steam game. I then updated Windows software. Now the steam does not work. I get an exception error. When I click on the link, it says invalid and deltes
-
How to open raw with nikon D5 on photoshop cs4 file?
How to open raw with nikon D5 on photoshop cs4 file?