Find the first row of each column

Hi all

Request:

I want to find the first line in the text frame columns.

Bug:

If the active document contains a single column, two columns, and multiple column text blocks. In this case, I'm not able to get my result

Try the script:

myDoc = app.activeDocument var

var myTextFrames = myDoc.textFrames.everyItem () .getElements)

for (i = 0; i < myTextFrames.length; i ++)

{

var myTextColumns1 = myTextFrames [i] .textColumns [1] .lines [0] .silence

Alert (myTextColumns1)

}

Attached, I have attached the error file.

If the active document contains only two block of text column, script executed successfully.

If the active document contains the single column text block and the sampling error two columns of text as below:

Screen Shot 2013-03-27 at 3.31.16 PM.png

Could someone find solution for my application.

Thanks in advance

BEGINNER

Try this,

myDoc = app.activeDocument var

var myTextFrames = myDoc.textFrames.everyItem () .getElements)

for (i = 0; i

{

for (var j = 0; j)

{

var myTextColumns1 = myTextFrames [i] .textColumns [j] .lines [0] .silence

$.writeln (myTextColumns1)

}

}

Tags: InDesign

Similar Questions

  • Find the first paragraph of each specific chained text block...

    Hi all

    I have this kind of layout:

    Capture d’écran 2015-08-27 à 10.46.02.png

    Capture d’écran 2015-08-27 à 10.46.20.png

    ... with several groups of text blocks chained [red, green,...].

    I want to find in the identity document all the first para of each text block defined by a "BLOCK of TEXT GREEN" object style and apply a paragraph style "GREEN PARA STYLE while FIRST THE block"! as:

    Capture d’écran 2015-08-27 à 10.47.01.png

    Thank you much for the help!

    Here is a new version:

    main();
    
    function main() {
        if (app.documents.length > 0) {
            var story, containers, container,
            doc = app.activeDocument,
            stories = doc.stories;
    
            try {
                app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
                app.findTextPreferences.appliedParagraphStyle = doc.paragraphStyles.item("GREEN PARA STYLE FIRST ON BLOCK");
                app.changeTextPreferences.appliedParagraphStyle = doc.paragraphStyles.item("GREEN PARA STYLE");
                doc.changeText();
                app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
            }
            catch(err) {
                $.writeln(err.message + ", line: " + err.line);
            }
    
            for (var i = 0; i < stories.length; i++) {
                story = stories[i];
                containers = story.textContainers;
                if (containers.length > 1) { // process only chained text blocks
                    for (var j = 0; j < containers.length; j++) {
                        container = containers[j];
                        if (container.appliedObjectStyle.name == "GREEN TEXT BLOCK") {
                            try { // if the style or the 1st paragraph is missing, write error message to console and continue
                                container.paragraphs[0].appliedParagraphStyle = doc.paragraphStyles.item("GREEN PARA STYLE FIRST ON BLOCK");
                            }
                            catch(err) {
                                $.writeln(err.message + ", line: " + err.line);
                            }
                        }
                    }
                }
            }
        }
        else {
            alert("Please open a document and try again.", "Error", true);
        }
    }
    
  • How to find the value duplicate of each column.

    I have it here are four columns,
    How can I find the duplicate of each columns value.

    with All_files like)
    Select ' 1000 'like BILL, "2000" AS DELIVERYNOTE, CANDELINVOICE ' 3000', '4000' CANDELIVERYNOTE of all union double
    Select ' 5000 ', ' 6000', ' 7000 ', ' 8000' Union double all the
    Select '9000 ', '1000', '1100',' 1200' from dual union all
    Select ' 1200 ', ' 3400', ' 6700 ', ' 8790' Union double all the
    Select ' 1000 ', ' 2000', ' 3000 ', ' 9000' Union double all the
    Select '1230', '2340', ' 3450 ', ' 4560' double
    )
    SELECT * from All_files


    Output should be as shown below.

    1000 2000 3000 4000
    9000 1000 1100 1200
    1200 3400 6700 8790
    1000 2000 3000 9000

    Required to check uniqueness columns.

    Thank you.

    Hello

    If you are not too concerned about performance, this should give you the desired result:

    SELECT distinct INVOICE, DELIVERYNOTE, CANDELINVOICE, CANDELIVERYNOTE
    FROM (
      SELECT a.*,
             count(*) over(partition by t.column_value) cnt
      FROM All_files a,
           table(
             sys.odcivarchar2list( a.INVOICE
                                 , a.DELIVERYNOTE
                                 , a.CANDELINVOICE
                                 , a.CANDELIVERYNOTE ) ) t
    )
    WHERE cnt > 1
    ;
    
  • extracting columns of string array 2D according to the first item of each column

    Hello

    I have an array of strings 2D and I want to extract the columns according to the string value to items in each column to formulate a new 2D array. for example:

    in the joint excel table sheet a 2D. I need to extract all contain columns "CA/S -" string and "MS/s" to formulat + another array of strings 2D form columns that contain only 2 string values.

    Thank you very much and I would reaally any input apperciiate

    See you soon,.

    Mostafa

    Something like that?  I had to convert your Excel file into a CSV file.

  • I have a column with two values, separated by a space, in each line. How to create 2 new columns with the first value in a column, and the second value in another column?

    I have a column with two values, separated by a space, in each line. How do I create 2 new columns with the first value in one column and the second value in another column?

    Add two new columns after than the original with space separated values column.

    Select cell B1 and type (or copy and paste it here) the formula:

    = IF (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')

    shortcut for this is:

    B1 = if (Len (a1) > 0, LEFT (A1, FIND ("", A1) −1), ' ')

    C1 = if (Len (a1) > 0, Member SUBSTITUTE (A1, B1 & "", ""), "")

    or

    the formula of the C1 could also be:

    = IF (Len (a1) > 0, RIGHT (A1, LEN (A1) −FIND ("", A1)), "")

    Select cells B1 and C1, copy

    Select cells B1 at the end of the C column, paste

  • I just started using my new iMac 27 "and in Mail, I can't find the setting to display a column that shows the number of emails in each folder.  Mavericks, I had this column.  I have checked all the menus and preferences and search online.

    I just started using my new iMac 27 "and in Mail, I can't find the setting to display a column that shows the number of emails in each folder.  Mavericks, I had this column.  I have checked all the menus and preferences and search online.

    Click the triangle next to the Inbox to view the Inbox for each account. Then select the desired mailbox and the information will be displayed in the upper part.

    You are entitled to 90 days telephone support from Apple. Try to contact them.

    Apple Support contact

    Apple Support by email or chat

    Contact Apple Support - phone

  • How to find the first Sunday and the second Saturday of each month

    Hi all

    How to find the first Sunday and the second Saturday of each month

    Thank you

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    994122 wrote:

    Hello

    I need to pass the months parameter how to do this? like Jan, Feb etc... (one of those)

    Do you have a procedure?

    Should you output only for the months you passed in the parameter?

    The easiest way is to set the parameter as date. When you go such as p_date as DATE ' 2014-10-01', then you can

    PROCEDURE two_dates)

    p_date IN DATE

    p_first_sunday DATE

    p_second_saturday DATE

    )

    IS

    BEGIN

    p_first_sunday: = NEXT_DAY (TRUNC (p_date, 'MM') - 1, TO_CHAR (DATE ' 2014-10-12', 'DAY'));

    p_second_saturday: = NEXT_DAY (TRUNC (p_date, 'MM') - 1, TO_CHAR (DATE ' 2014-10-11', 'DAY')) + 7;

    END two_dates;

    Or you describe what you need.

  • How to find the first max value for each item

    Hello

    I have the me_result of the table as below,

    SELECT * FROM me_result;

    ID     ||| ELITE     ||||||||||| FREQ_ITEM | COMBINED_STR | SUP
    1     ||; 1; 10; 2; 3; 4; 5; 7; 8. 1     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    2     ||; 1; 10; 2; 3; 4; 5; 7; 8. 2     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    3     ||; 1; 10; 2; 3; 4; 5; 7; 8. 3     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    4     ||; 1; 10; 2; 3; 4; 5; 7; 8. 4     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    5     ||; 1; 10; 2; 3; 4; 5; 7; 8. 5     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    6     ||; 10; 2; 3; 4; 5; 8; 9. 1     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9; 1 ||| 1
    7     ||; 10; 2; 3; 4; 5; 8; 9. 2     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2
    8     ||; 10; 2; 3; 4; 5; 8; 9. 3     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2
    9     ||; 10; 2; 3; 4; 5; 8; 9. 4     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2
    10     ||; 10; 2; 3; 4; 5; 8; 9. 5     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2


    I need to find the first COMBINED_STR max for each element of the ELITE,
    I mean, max value is the max REGEXP_COUNT (combined_str,' ;')))

    really, I try to write down, but I had a lot of values for each ELITE and I need only the first, that
    SELECT * from me_result
    WHERE (ELITE, REGEXP_COUNT (combined_str,' ;')))) IN
    (SELECT ELITE, MAX (REGEXP_COUNT (combined_str,' ;'))))) ME_RESULT ELITE GROUP);

    I need the result to be as below.

    1; 1; 10; 2; 3; 4; 5; 7; 8-1; 1; 10; 2; 3; 4; 5; 7; : p
    6; 10; 2; 3; 4; 5; 8; 9 1; 10; 2; 3; 4; 5; 8; 9; 1 1

    any help please,.

    Published by: user11309581 on July 10, 2011 22:03

    Can be

    with t as
    (select 1     ID, ';1;10;2;3;4;5;7;8'     ELITE, 1     FREQ_ITEM, ';1;10;2;3;4;5;7;8' COMBINED_STR, 2 SUP from dual union all
    select 2     ,';1;10;2;3;4;5;7;8'     ,2     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 3     ,';1;10;2;3;4;5;7;8'     ,3     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 4     ,';1;10;2;3;4;5;7;8'     ,4     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 5     ,';1;10;2;3;4;5;7;8'     ,5     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 6     ,';10;2;3;4;5;8;9'     ,1     ,';10;2;3;4;5;8;9;1'     ,1 from dual union all
    select 7     ,';10;2;3;4;5;8;9'     ,2     ,';10;2;3;4;5;8;9'     ,2 from dual union all
    select 8     ,';10;2;3;4;5;8;9'     ,3     ,';10;2;3;4;5;8;9'     ,2 from dual union all
    select 9     ,';10;2;3;4;5;8;9'      ,4     ,';10;2;3;4;5;8;9'     ,2 from dual union all
    select 10     ,';10;2;3;4;5;8;9'     ,5     ,';10;2;3;4;5;8;9'     ,2 from dual
    )
    select ID,ELITE,FREQ_ITEM,COMBINED_STR,SUP
    from (
      SELECT ID,ELITE,FREQ_ITEM,COMBINED_STR,SUP, ROW_NUMBER() over (PARTITION BY ELITE order by id) RN
      FROM t
      WHERE (ELITE,REGEXP_COUNT(combined_str,';')) IN
        (SELECT ELITE,MAX(REGEXP_COUNT(combined_str,';')) FROM t GROUP BY ELITE)
    ) where RN=1
    order by id
    
    ID                     ELITE             FREQ_ITEM              COMBINED_STR      SUP
    ---------------------- ----------------- ---------------------- ----------------- ----------------------
    1                      ;1;10;2;3;4;5;7;8 1                      ;1;10;2;3;4;5;7;8 2
    6                      ;10;2;3;4;5;8;9   1                      ;10;2;3;4;5;8;9;1 1     
    
  • How to take advantage of the first letter of each word in Mysql

    Hello

    I tried to put a large database where visitors have been botched when entering text. The main thing I want to do is to capitalize the first letter of each word in Mysql.

    I found the code below in PHP, but it continues to find an error on the TIME line:

    <? PHP ini_set ('display_errors, 1');? >

    <? php require_once('Connections/maison_connection.php');? >

    <? PHP

    $result = mysql_query ("SELECT column, id FROM table");

    While ($row = {mysql_fetch_array ($result))}

    $id = $row ['id'];

    $column2 = ucwords ($row ["column"]);

    $query2 = "UPDATE table SET column = ' $column2′ WHERE id = '$id" ";

    mysql_query ($query2);

    }

    ? >

    My table is called mailing list and the column name is called, so I modified the script to do this: but it still shows the same error while:

    <? PHP ini_set ('display_errors, 1');? >

    <? php require_once('Connections/maison_connection.php');? >

    <? PHP

    $result = mysql_query ("SELECT name, id FROM mailing list");

    While ($row = {mysql_fetch_array ($result))}

    $id = $row ['id'];

    $Name2 = ucwords ($row ['Name']);

    $query2 = "UPDATE LISTSERV SET name = ' $Name2′ WHERE id = '$id" ";

    mysql_query ($query2);

    }

    ? >

    Any ideas?

    
    

    The key is to use a multidimensional array. The first time the while loop runs through the database results, $i is 0, so the values are assigned to the $updates [0] ['id'] and $updates [0] ["Name"]. The following becomes $updates [1] ['id'] and $updates [1] ["Name"] and so on.

    The loop resets $i to 0, and uses count ($updates) to get the length of the array. It then updates each row by using $updates [0] ["Name"] and $updates [0] ['id'], $updates [1] ["Name"] and $updates [1] ['id'] and so on.

  • Find the first empty cell

    OK so I use numbers to design a "schedule" for lack of a better word for a flight instructor course. On the summary page, I need to be able to identify the next sequence of flight for each student. I have a sheet that contains all flights that each student must perform and the date which they filled. So what I need on the summary page is someway to watch flight logs and determine what the next flight is to find the first empty cell under each name of students. I have no idea how to go about that though, so if you have any ideas I would be grateful

    Hello j,

    Here are two possibilities, both illustrate below. They are independent of each other and can be used alone or together.

    If students all sequences in chronological order, and the dates in columns are values of Date and real time, you should be able to locate the first empty line using MATCH and MAX.

    Because all dates entered will be 'today' or 'before today', a conditional highlighting rule could be used to color the background of the cell to a cell where a date has been entered.

    Table 1 gives the master record. Table 2 shows the following sequence for the student and the line of table 1, which the sequence is listed.

    Two formulas are used:

    Table 2::B3 and filled with right: = MATCH (MAX (table 1: B), Table 1: B, 0) + 1

    Table 2::B2 and filled with right: = OFFSET (table 1: $A$ 1, B3-1, 0)

    This method is based on the sequences being completed in the order listed, as it seems the most recent (that is to say date the "bigger").

    The rule of conditional formatting applied to all cells in columns B, C and D of table 1 fills every cell that contains a date before the next day with yellow, giving a visual indication of where all the next vacant cell.

    This indicator is independent of the order of the sequences, because it depends on only that there is a date or before 'today' in each cell to be highlighted.

    Kind regards

    Barry

  • Remove duplicates by selecting the first line of each subgroup in a Recordset

    Oracle: 11 GR 2

    Client Windows 7

    I have a set of data (the result of a query) which is similar to:

    D_rank product_id product_desc category income price cost

    1 112233 prod1-iphone phone 200 500 100

    1 112233 prod1-iphone4 phone 200 500 100

    2 223344 prod2-300 1000 400 windows7 OS

    2 223344 prod2-300 1000 400 software windows7

    3 334455 prod3-Mac 1000 computer 1500-1000

    4 445566 prod4-xyz 2000 800 1200 misc

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    As you can see the first 4 rows, these rows are repeated due to the product_desc and category material. I need these fields but the first value in each subgroup, so that each row is unique. I.e.

    D_rank product_id product_desc category income price cost

    1 112233 prod1-iphone phone 200 500 100

    2 223344 prod2-300 1000 400 windows7 OS

    3 334455 prod3-Mac 1000 computer 1500-1000

    4 445566 prod4-xyz 2000 800 1200 misc

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    You will enjoy the little help.

    Hello

    user13667036 wrote:

    Oracle: 11 GR 2

    Client Windows 7

    I have a set of data (the result of a query) which is similar to:

    D_rank product_id product_desc category income price cost

    1 112233 prod1-iphone phone 200 500 100

    1 112233 prod1-iphone4 phone 200 500 100

    2 223344 prod2-300 1000 400 windows7 OS

    2 223344 prod2-300 1000 400 software windows7

    3 334455 prod3-Mac 1000 computer 1500-1000

    4 445566 prod4-xyz 2000 800 1200 misc

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    :                    :               :                                   :               :             :              :

    As you can see the first 4 rows, these rows are repeated due to the product_desc and category material. I have need of these fields but the first value of each subgroup...

    ...

    What does "first" here?  What "subgroup"?

    Depending on your needs, maybe you want to Request Top - N, something like this:

    WITH got_r_num AS

    (

    SELECT d_rank, product_id, product_desc, category, price, income, cost

    ROW_NUMBER () OVER (PARTITION BY d_rank

    ORDER BY product_desc, category

    ) AS r_num

    OF data_set

    )

    SELECT d_rank, product_id, product_desc, category, price, income, cost

    OF got_r_num

    WHERE r_num = 1

    ;

    I hope that answers your question.

    If this isn't the case, please post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.  (I know you said this is a game of results from a query, and not an array, but the solution is the same as the entry is a single table, or a query, perhaps involvoing several tables.)

    Report when the request above is erroneous results and explain, using specific examples, how find you the correct results from these data.

    As said ground, see the FAQ in the forum: Re: 2. How can I ask a question on the forums?

  • How to get the sum of the first row in the previous row?

    Dear gurus... I need to get the sum of a column of the first row of my result set to the previous line based on a condition. I read analytical functions for this but they provide the sum of the first rank to Current Row through declaration "rows between Unbounded preceding and current line. Y at - it a statement that calculates the sum as "rows between Unbounded preceding and previous row?

    Hello

    kamranpathan wrote:
    Dear gurus... I need to get the sum of a column of the first row of my result set to the previous line based on a condition. I read analytical functions for this but they provide the sum of the first rank to Current Row through declaration "rows between Unbounded preceding and current line.

    If you do not explicitly give a windowing clause, then you get the default windowing clause you indicated.
    If you want another clause of windowing, ionclude in the analytic function call.

    Y at - it a statement that calculates the sum as "rows between Unbounded preceding and previous row?

    Yes. The correct syntax for "Previous rank" is «PREVIOUS 1»

    ...  ROWS BETWEEN  UNBOUNDED PRECEDING
                AND        1          PRECEDING
    

    For more information, search for "Analytic Functions" in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions004.htm#sthref917

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    You will find the answers better faster if you always provide this information whenever you post a question.

    Published by: Frank Kulash, Sep 17, 2011 17:04
    I just saw Etbin responses.
    As usual, Etbin has a good point. If the column that you are basically cannot be NULL, then it is probably easier to subtract the total current line and use the default windowing clause.
    Even if it can be null, you find may be easier to use this approach.

  • Problem with the removal of the first row of the table

    Hi all

    I have a problem with my forms with tables where I have buttons to add or remove rows from the table. Adding the lines works fine but deleting lines has a problem when deleting the first row. Example: Here is a table with two rows where column 1 has the add and remove buttons and column 2 user imput that looks like this:

    Column 1
    Column 2
    Add and remove buttons hererank 1
    Add and remove buttons hererank 2
    Add and remove buttons hererank 3

    If the user deletes line 2 the table looks like which is correct:

    Column 1
    Column 2
    Add and remove buttons hererank 1
    Add and remove buttons hererank 3

    If the user deletes line 1 then the table looks like which is false since the ranks 2 and 3 should be left:

    Column 1
    Column 2
    Add and remove buttons hererank 1
    Add and remove buttons hererank 3

    The code is pretty simple:

    Table3.row2.instanceManager.addInstance (1); for the click event of the button Add line

    Table3.row2.instanceManager.removeInstance (1); for the click event of the button Delete line

    What I am doing wrong?

    Thanks in advance!

    Al

    The expression will be based on your structure... done .This refers to the current object, parent refers to the container parent of this object and index is the index of this object. So watching your hierarchy and from the key, you will need this.parent to join the line subform is it in (usually it is th esubform that repeats). If it's in a subform, you will need to add another parent. Continue on this road until you get to the repeating subform and then ask its index. Your expression might look like this.parent.parent.parent.index. Using this.index, you find the instance of the button object and there are just people and that's why you always get 0.

    Make sense?

    BTW your form is attached not... so I can't check what you should put it.

    Paul

  • How the auto uppercase the first letter of each sentence

    I use the latest version of the Pages on the Sierra of the OS and I am trying to find a way to automatically capitalize the first letter of each sentence with nothing doesn't. I've been a user of Pages for years and every time announced a new update is all what I care about is adding this feature simple but important. So, now that the new update is here I can not yet understand how to take advantage of the auto and I can't find workarounds online to help me do it. Any idea?

    You can use WordService from DEVONtechnologies, free in the Mac App Store. You can then go to System Preferences > keyboard > shortcuts > Services & enable those you want. You can then select the text you want to apply the service to & go to Pages > Services & select initial caps of sentences. It is also possible to assign a keyboard shortcut to services. With the help of this device, or similar functionality in any word processing application still not to revert to words in a sentence that should be capitalized as 'I' or pronunciations. You will also have the problem of it capitalized words after the period for the abbreviation.

    I do it the traditional way, using the SHIFT key when necessary. It is advisable to learn to type using the SHIFT key, rather than relying on the software to do it for you. Just like the use of a spellchecker. It's good, but it will not go back on the words that are spelled correctly but not the correct spelling of the situation.

  • How to freeze the first row in Microsoft Excel 2008 for MAC (worms. 12.3.6.)?

    Hello world

    I need to set the first row of a table in Excel 2008 for Mac. I know it should by a button, but don ' t have probably, or is hidden somewhere I checked the point of view, the tools and all the menu, I didn't find, y at - he someone to help me? Thank you

    Make sure you are in Normal mode, not Page view

    Go to the window in the menu bar and select freeze the panes

    Then you should be able to scroll through the sheet with line 1 has left in place.

    If you need for example three rows frozen, go to the fourth line and select freeze the panes.

    Then you should be able to scroll through the sheet with lines 1 to 3 from left in place.

Maybe you are looking for