Reading data from a text (JS CS3) file tabs-delimited
Hi - I'm working on a script to read data from a text file and use in a dialog box. But I hit a wall.
I used a script from a previous post that defines a variable text document when the user script he chooses from a drop-down list.
var myDialog = app.dialogs.add({name:"Map",canCancel:true});)
{with (MyDialog)}
{with (dialogColumns.Add ())}
{with (borderPanels.Add ())}
staticTexts.add ({staticLabel: "choose the location :"});})
{with (dialogColumns.Add ())}
var file = File("~/Desktop/myPlacesfile.txt");
leader. Open ("r");
var str = file.read ();
leader. Close();
var myPlaceList = str.split (/ [\r\n] + /);
var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})
}
}}}
Ditto var = myDialog.show ();
if(myResult == true) {}
If (myPlaceMenu.selectedIndex == 0) {}
myPlace var = ' - undefined ";
} else {}
myPlace var = myPlaceList [myPlaceMenu.selectedIndex];
Alert (myPlace);
}
myDialog.destroy ();
}
That's what I do now:
The text file is in this format:
Value1 value2 [TAB]
Value1 value2 [TAB]
Value1 value2 [TAB]
I need to have the drop down dialog box show only the value 1, and after that the user selects, the script returns only the value 2. (The alert is just there to test - I'm doing something else with the variable).
Is there a way to view the first part of a tab-delimited line in the menu drop down and return the second half as a variable?
Any help would be greatly appreciated.
Thank you
One of the possibilities is that it. Create a table to the left of the values of the tab of the dialog box. Then create an object that you use it as a table of correspondence. Roughly as follows:
same thing as what you have
leader. Open ("r");
var str = file.read ();
leader. Close();
var array = str.split (/ [\r\n] + /);
'pairs' are the table of correspondence
pair of var = {};
as before, 'myPlaceList' will be used for the menu drop-down
var myPlaceList = [];
var v;
for (var i = 0; i)< array.length;="">
{
v = table [i] .split ('\t');
pairs [v [0]] = v [1];
myPlaceList.push (v [0]);
}
Add the drop-down list as before:
var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})
the table of 'pairs' correspondence is used as follows: pairs ['value1'] returns 'value2 '.
so in your script that would be:
myPlace var pairs = [myPlaceList [myPlaceMenu.selectedIndex]];
Peter
Tags: InDesign
Similar Questions
-
Hi, using Cp 8.01.
I would like to read the textual data to a text or XML file into a variable in order to display a message (using a form) on my project of Cp can I do this without using Javascript?
Thank you.
You need JS.
-
How to read data from an excel and HTML file
Hello
I write a 2D-array of string in Excel/HTML file using the generation of reports.
Can someone tell me how to get back in return, the written data, same files again and display in table format.
Thank you & best regards
Visuman
You can use activex to read data from the excel fileback to the table format... through this vi... may b this will help you...
-
Read data from the text column in report
I have a sql report with an editable column created using apex_item.text (5);
I tried to read and insert the data from the column in a table, using this process
because me in 1.apex_application.g_f05.count
loop
insert into table (col_a, col_b)
values (apex_application.g_f05 (i), apex_application.g_f04 (i));
commit;
end loop;
end;
but without success.
The message when I execute is ORA-01403: no data found.
What is the error?HI lkefur,
Try to debug it.
The reason behind this is that your report do not have the of4, fo5 (one) as text fields at all.
try to delete value n f04 normal text and check, even to f05.
I think that most probably the reason whether shud.You can view only the source of the page and check which names are your text fields of the report to help.
Kind regards
Nandini thakur. -
Write and read data from the user's local file system
Hello
I write my first extension for dreamweaver. My extension should backup the data on the local file system of the user. I know that I can use DWfile.read () and DWfile.write () as described in Chapter 2 of the Dreamweaver API reference. I store the data using the XML format. What is the best way to read and parse the XML data in the file? What is the best way to write the XML data in the file?
If you recommend one format other than XML, I'm open to suggestions. The data are only a few configuration information for the extension which should be persisted.
Thank you
mitzy_kitty
How will the data be used? If it is used by JavaScript, use JSON format which includes js. If you use XML, then you will need to find an XML parser to read the data.
Randy
-
How to read data from an Excel 2010 worksheet with the .xlsx extension? The data I want, it's on one of the 10 tabs in the file, I have to choose which programmatically. I have the Report Generation Toolkit for LV2012, but all the screws that come with it seem to focus around writing data to a spreadsheet Excel and make charts and whatnot. I want to * read * an Excel worksheet. Seeking answers led to many 'Open it and save it as tab delimited text', which I can't do because I need data from different tabs, and because this file is quite dynamic with many users opening and adding several times. In order to save the tab I want as a tab delimited text file per programming, I'm back a square, how to open it?
My solution would ideally fill in the blanks of: spreadsheet.xlsx---> _---> 2 or 3D data table.
Thank you
Adam
This fixes:
-
Load the data from a text file into a table using pl/sql
Hi Experts,
I want to load the data from a text file (sample1.txt) to a table using pl/sql
I used the pl/sql code below
***********************************
declare
f utl_file.file_type;
s varchar2 (200);
c number: = 0;
Start
f: = utl_file.fopen('TRY','sample1.txt','R');
loop
UTL_FILE.get_line (f, s);
insert into sampletable (a, b, c) values (s, s, s);
c: = c + 1;
end loop;
exception
When NO_DATA_FOUND then
UTL_FILE.fclose (f);
dbms_output.put_line('No. deles de lignes insérées: ' || c);
end;
***************************************
and my sample1.txt file looks like
***************************************
1
2
3
***************************************
Gets the data inserted, with way below
Select * from sampletable;
A, B AND C
1-1-1
2-2-2
3 3 3
I want that data to get inserted as
A, B AND C
1 2 3
The text file I have is to have three lines, and the first value of each line should go to each column
Help, please...
Thank youdeclare f utl_file.file_type; s1 varchar2(200); s2 varchar2(200); s3 varchar2(200); c number := 0; begin f := utl_file.fopen('TRY','sample1.txt','R'); utl_file.get_line(f,s1); utl_file.get_line(f,s2); utl_file.get_line(f,s3); insert into sampletable (a,b,c) values (s1,s2,s3); c := c + 1; utl_file.fclose(f); exception when NO_DATA_FOUND then if utl_file.is_open(f) then utl_file.fclose(f); ens if; dbms_output.put_line('No. of rows inserted : ' || c); end;
SY.
-
Can read data from xls using teststand 3.5?
Hello
I use 3.5 TestStand and LabVIEW 8.je know these are quite old versions now, but we must continue with this on a test bench.
My question is how can I read data from the file xls using TestStand 3.5? I have already mentioned a few posts on this, and one response suggested that I should use "tGetExcel" using ActiveX adapter. I tried to run the test example related to "http://forums.ni.com/t5/NI-TestStand/Write-or-read-to-Excel-from-TestStand/td-p/250439/highlight/tru...", but a run-time error. He says that "the tGetExcel type library information not found. Make sure that the server is registered in the system.
TestStand 4.2, I could easily run excel at the base of operations by using the Office Excel Toolkit.
I was wondering, is there another way, I can read just .xls file data by using Teststand 3.5?
Thank you
Niraj.
Please check this example for charger of property:
C:\Program Files (x 86) \National Instruments\TestStand 3.5\Examples\LoadingLimits
This shows the limits of excel file loading.
But you can load the values of the variables-consult the help file / Reference manual for this type of step.
Also in the loader type forum search property - you can find more information.
I hope this helps.
-
Read data from table of $ E and insert in the staging table
Hi all
I'm new on ODI. I need your help to understand how to read data from a table ' E$ "and insert in an intermediate table.
Scenario:
The name of two columns, in a flat file, the employee and the employee id must be loaded into a data EMPstore +. A check constraint is added so that the data with the employee names in capital letters only to load in the data store. Check the command is set to the static movement . Right-click on the data store, select control , then check. The lines that have violated the check constraint are kept in E$ _EMP+ table.
Problem:
Problem is I want to read the data in the table E$ _EMP+ and transform in capital letters in the name of the employee and move the corrected data of E$ _EMP+ EMP+. Please advise me on how to automatically manage the 'soft' exceptions in ODI.
Thank youIf I understand, you want to change the columns in the tables of $ E and then load into the target.
Now, if you notice how ODI recycles the error, there is an incremental update to the target using the E table $ after he filled the I$ table.
I think you can do the same thing by creating an interface using the table of $ E as source and implement the business logic in this interface to fill the target.
-
How to save data from the COM port to file?
Hi all
can someone tell me please how to save data from the COM port on file? I transfer 1 byte of serial port... attached is the image of the vi... very basic.
I would like to save the data in a table... I mean, 1 data--> data--> data tab 2 tab 3rd--> tab
and so on... can anyone help?
-
export data from the table in xml files
Hello
This thread to get your opinion on how export data tables in a file xml containing the data and another (xsd) that contains a structure of the table.
For example, I have a datamart with 3 dimensions and a fact table. The idea is to have an xml file with data from the fact table, a file xsd with the structure of the fact table, an xml file that contains the data of the 3 dimensions and an xsd file that contains the definition of all the 3 dimensions. So a xml file fact table, a single file xml combining all of the dimension, the fact table in the file a xsd and an xsd file combining all of the dimension.
I never have an idea on how to do it, but I would like to have for your advise on how you would.
Thank you in advance.You are more or less in the same situation as me, I guess, about the "ORA-01426 digital infinity. I tried to export through UTL_FILE, content of the relational table with 998 columns. You get very quickly in this case in these ORA-errors, even if you work with solutions CLOB, while trying to concatinate the column into a CSV string data. Oracle has the nasty habbit in some of its packages / code to "assume" intelligent solutions and converts data types implicitly temporarily while trying to concatinate these data in the column to 1 string.
The second part in the Kingdom of PL/SQL, it is he's trying to put everything in a buffer, which has a maximum of 65 k or 32 k, so break things up. In the end I just solved it via see all as a BLOB and writing to file as such. I'm guessing that the ORA-error is related to these problems of conversion/datatype buffer / implicit in the official packages of Oracle DBMS.
Fun here is that this table 998 column came from XML source (aka "how SOA can make things very complicated and non-performing"). I have now 2 different solutions 'write data to CSV' in my packages, I use this situation to 998 column (but no idea if ever I get this performance, for example, using table collections in this scenario will explode the PGA in this case). The only solution that would work in my case is a better physical design of the environment, but currently I wonder not, engaged, as an architect so do not have a position to impose it.
-- --------------------------------------------------------------------------- -- PROCEDURE CREATE_LARGE_CSV -- --------------------------------------------------------------------------- PROCEDURE create_large_csv( p_sql IN VARCHAR2 , p_dir IN VARCHAR2 , p_header_file IN VARCHAR2 , p_gen_header IN BOOLEAN := FALSE, p_prefix IN VARCHAR2 := NULL, p_delimiter IN VARCHAR2 DEFAULT '|', p_dateformat IN VARCHAR2 DEFAULT 'YYYYMMDD', p_data_file IN VARCHAR2 := NULL, p_utl_wra IN VARCHAR2 := 'wb') IS v_finaltxt CLOB; v_v_val VARCHAR2(4000); v_n_val NUMBER; v_d_val DATE; v_ret NUMBER; c NUMBER; d NUMBER; col_cnt INTEGER; f BOOLEAN; rec_tab DBMS_SQL.DESC_TAB; col_num NUMBER; v_filehandle UTL_FILE.FILE_TYPE; v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file); v_CRLF raw(2) := HEXTORAW('0D0A'); v_chunksize pls_integer := 8191 - UTL_RAW.LENGTH( v_CRLF ); BEGIN c := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE); DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab); -- FOR j IN 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,4000); WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); ELSE DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,4000); END CASE; END LOOP; -- -------------------------------------- -- This part outputs the HEADER if needed -- -------------------------------------- v_filehandle := UTL_FILE.FOPEN(upper(p_dir),p_header_file,p_utl_wra,32767); -- IF p_gen_header = TRUE THEN FOR j IN 1..col_cnt LOOP v_finaltxt := ltrim(v_finaltxt||p_delimiter||lower(rec_tab(j).col_name),p_delimiter); END LOOP; -- -- Adding prefix if needed IF p_prefix IS NULL THEN UTL_FILE.PUT_LINE(v_filehandle, v_finaltxt); ELSE v_finaltxt := 'p_prefix'||p_delimiter||v_finaltxt; UTL_FILE.PUT_LINE(v_filehandle, v_finaltxt); END IF; -- -- Creating creating seperate header file if requested IF NOT v_samefile THEN UTL_FILE.FCLOSE(v_filehandle); END IF; END IF; -- -------------------------------------- -- This part outputs the DATA to file -- -------------------------------------- IF NOT v_samefile THEN v_filehandle := UTL_FILE.FOPEN(upper(p_dir),p_data_file,p_utl_wra,32767); END IF; -- d := DBMS_SQL.EXECUTE(c); LOOP v_ret := DBMS_SQL.FETCH_ROWS(c); EXIT WHEN v_ret = 0; v_finaltxt := NULL; FOR j IN 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN -- VARCHAR2 DBMS_SQL.COLUMN_VALUE(c,j,v_v_val); v_finaltxt := v_finaltxt || p_delimiter || v_v_val; WHEN 2 THEN -- NUMBER DBMS_SQL.COLUMN_VALUE(c,j,v_n_val); v_finaltxt := v_finaltxt || p_delimiter || TO_CHAR(v_n_val); WHEN 12 THEN -- DATE DBMS_SQL.COLUMN_VALUE(c,j,v_d_val); v_finaltxt := v_finaltxt || p_delimiter || TO_CHAR(v_d_val,p_dateformat); ELSE v_finaltxt := v_finaltxt || p_delimiter || v_v_val; END CASE; END LOOP; -- v_finaltxt := p_prefix || v_finaltxt; IF SUBSTR(v_finaltxt,1,1) = p_delimiter THEN v_finaltxt := SUBSTR(v_finaltxt,2); END IF; -- FOR i IN 1 .. ceil( LENGTH( v_finaltxt ) / v_chunksize ) LOOP UTL_FILE.PUT_RAW( v_filehandle, utl_raw.cast_to_raw( SUBSTR( v_finaltxt, ( i - 1 ) * v_chunksize + 1, v_chunksize ) ), TRUE ); END LOOP; UTL_FILE.PUT_RAW( v_filehandle, v_CRLF ); -- END LOOP; UTL_FILE.FCLOSE(v_filehandle); DBMS_SQL.CLOSE_CURSOR(c); END create_large_csv;
-
I have a function that I would read in pl/sql. How can I read data from it. EMPARRAY function return.
FUNCTION META_PODATKI_TABEL
(ime_tabele VARCHAR2, st_napake NUMBER
)
RETURN EMPARRAY ACE
EMPARRAY is:
create or replace TYPE "EMPARRAY" as VARRAY (10000) OF VARCHAR2 (4000);
I try but nothing works.
THXPut the function calls in the clause of a query using the TABLE from:
SQL> create or replace TYPE "EMPARRAY" as VARRAY(10000) OF VARCHAR2(4000); 2 / Type created. SQL> create or replace FUNCTION META_PODATKI_TABEL 2 (ime_tabele VARCHAR2, st_napake NUMBER 3 ) 4 RETURN EMPARRAY AS 5 begin 6 return emparray('aaa','bbb','ccc'); 7 end; 8 / Function created. SQL> select * from table(META_PODATKI_TABEL('x',1)); COLUMN_VALUE ------------------------------------------------------------------------------------ aaa bbb ccc
Max
http://oracleitalia.WordPress.com -
Read data from APEX_ITEM
Hi all
I searched the forums, and unfortunately I have no idea on how to go on the following.
I have the following SQL report created with APEX_ITEM. SELECT_LIST-
> select id, questions, APEX_ITEM. SELECT_LIST (p_idx = > 1, p_value = > '- Select Rating-', p_list_values = > 1, 1, 3, 3, 5, 5', p_attributes is > "style =" "color: Black;"', p_show_null = > 'YES', p_null_value = > NULL, p_null_text = > '- Select Rating-', p_item_id = > ' the ROWNUM # f01_ #', p_item_label = > ' label for ROWNUM f01_ # #', p_show_extra = > 'NO') 'Rating' of the sqa_customer_questions by id order
Query runs as you like, but I don't know how to accept the values of the rows. I would like to insert the values of the selection list and their respective ID for all the entries in another table. I'm not able to find out how I could read data from these APEX_ITEMs and reach my goal.
Any help is appreciated.
Kind regards
Jean-PierreNope,
Can you put the app on apex.oracle.com
In any case if you have a report like this
SELECT id, something FROM table
You can do it for the
SELECT id||APEX_ITEM.HIDDEN(2,id) id, something FROM table
And then reference it as APEX_APPLICATION. G_F02 (the first parameter provided to apex_item determine the number) in your process.
See you soon
Ben
http://www.munkyben.WordPress.com
Don't forget to mark the answers useful or correct ;) -
Hello to everyone
I use oracle forms 6i. I want to read data from a serial port. How can I do this?HII,
You may search for any existing OCX or VBX component capable of doing this job.
Better compliance
Skyniazi -
I would like to read data (sepereated of numbers with spaces) and write them in a table. That's what I have so far.
Thank you.
Try to use "worksheet reading File.vi. The only thing you will obviously need to change is the delimiter character, which seems to be a white. In the default configuration, spreadsheet files using the tabs as separators...
Norbert
Maybe you are looking for
-
Can not see all the networks Wi - Fi on Satellite P755-S5263
Hello Just unwrap my gift: Satellite P755-S5263 and he can't see any wi - fi, I'm in the city and see a lot of networks on my BB and I press the touch button below the LCD for WE / OFF radio, nothing help, just orange light on the light wi - fi. No p
-
Wie kann ich mein Imovie Projekt auf einer externen Fliegengitter speichern?
Meine Fahrradhalter ist voll und ich möchte mein Projekt auf meiner externen Fliegengitter speichern gern. Leider finde ich keine possibility. ICH habe Version 10.1 im Einsatz. Mein Mac ist neu und ich komme aus der Welt-MS.
-
Individual access to the inputs and outputs on a single port (PXI-6509
Hello I use PXI-6509 and this sentence taken from the Manual: "You can use each of the DIO lines as the input to a digital static (DI) or digital output (DO) line" leads me to believe that each individual DIO can be defined as input or output (even w
-
Family Windows XP Edition installation error code
I am trying to install Windows XP Home Edition on a new PC and I got the following error message: "an error was encounterd that prevents all upward. Data error: cyclic redundancy check verification. Set up the file log says: Installation failed:D:\
-
Lack of choice 'Properties' from the 'Action' pane in the Task Scheduler
Using Vista Home Premium SP2 and tryingl to remove the Planner section of oblsolete tasks (the software has been removed from the machine), but there is no option to remove. I understand that it should be in a 'properties' falling down, but it does n