Calculate using previous column and rows

Hello TNO members,
I have a complicated problem I need to solve, how ever I am missing knowledge about calculating using previous rows and columns in current select.
Test data
with t as (
  select 1 as box, 1 as box_group, 10 as max_qty from dual union all
  select 2, 1, 15 from dual union all
  select 3, 1, 40 from dual union all
  select 4, 1, 45 from dual union all
  select 5, 2, 15 from dual union all
  select 6, 2, 20 from dual union all
  select 7, 2, 20 from dual union all
  select 8, 3, 20 from dual)Expected Output result
box box_group max_qty assigned_from_60
1   1         10      10  
2   1         15      15
3   1         40      17
4   1         45      18
5   2         15      0
6   2         20      0
7   2         20      0
8   3         20      0The problem:
In total 60 items are shared among the boxes in the same group, ordered by the lowest max_qty.
10 items can be assign to each box in group 1. (Used items: 40)
The remaining 20 items will be assigned to the other boxes in group 1.
5 more items can be assign to each box in group 1 (Used items: 15)
The remaining 15 items will be assigned to the remaining boxes in group 1.
2 more items can be assign to each box in group 1 (used items: 4)
One item remains. When items cannot be shared equally among the remaining boxes, ordered by the highest max_quantity, assign +1 till no item remains.
My solution in steps:
1. Calculate max_qty difference. How can I calculate the difference between the max_qty from box 1 and 2? Tricky is not to calculate the difference between different groups.
This means output result should be something like
box box_group max_qty qty_dif
1   1         10      10  
2   1         15      5
3   1         40      25
4   1         45      5
5   2         15      15
6   2         20      5
7   2         20      0
8   3         20      202. Remaining boxes in the same group. I want to know how many boxes are in the same group. Especially the remaining boxes when the current max_quantity is filled.
Using the following code does not result in the correct output, what is wrong or missing here?
count(*) over(partition by box_group order by max_qty asc range between current row and unbounded following) This means output result should be something like
box box_group max_qty qty_dif rem_boxes
1   1         10      10      4  
2   1         15      5       3
3   1         40      25      2
4   1         45      5       1
5   2         15      15      3
6   2         20      5       2
7   2         20      0       1
8   3         20      20      13. Calculate costs. This one is faily easy rem_boxes * qty_dif (*per row*)
This means output result should be something like
box box_group max_qty qty_dif rem_boxes cost
1   1         10      10      4         40
2   1         15      5       3         15
3   1         40      25      2         50
4   1         45      5       1         5
5   2         15      15      3         45
6   2         20      5       2         10
7   2         20      0       1         0
8   3         20      20      1         204. Calculate rem_items. 60 - (rem_boxes * qty_dif of box 1) - (rem_boxes * qty_dif of box 2) - (rem_boxes * qty_dif
of box n). How can I calculate using results of previous rows? (*all, not per group*)
This means output result should be something like
box box_group max_qty qty_dif rem_boxes cost rem_items
1   1         10      10      4         40   20
2   1         15      5       3         15   5
3   1         40      25      2         50   -45
4   1         45      5       1         5    -50
5   2         15      15      3         45   -95
6   2         20      5       2         10   -105
7   2         20      0       1         0    -105
8   3         20      20      1         20   -1255. Assign full quantity. For each row check if rem_items > 0 then 1 else 0
This means output result should be something like
box box_group max_qty qty_dif rem_boxes cost rem_items assign
1   1         10      10      4         40   20        1
2   1         15      5       3         15   5         1
3   1         40      25      2         50   -45       0
4   1         45      5       1         5    -50       0
5   2         15      15      3         45   -95       0
6   2         20      5       2         10   -105      0
7   2         20      0       1         0    -105      0
8   3         20      20      1         20   -125      06. Calculate assign quantity attemp 1. Calculate assign quantity of remaining boxes per group
When assign = 1 then max_qty else pervious a_qty (*within same group*)
This means output result should be something like
box box_group max_qty qty_dif rem_boxes cost rem_items assign a_qty
1   1         10      10      4         40   20        1       10
2   1         15      5       3         15   5         1       15
3   1         40      25      2         50   -45       0       15
4   1         45      5       1         5    -50       0       15
5   2         15      15      3         45   -95       0       0
6   2         20      5       2         10   -105      0       0
7   2         20      0       1         0    -105      0       0
8   3         20      20      1         20   -125      0       0How to solve the rest, I do not know yet. Any other suggestion to solve this problem, is welcome.
Since I'm not really a professional this is what I tried till now
with z as (
  select 1 as box, 1 as box_group, 10 as max_qty from dual union all
  select 2, 1, 15 from dual union all
  select 3, 1, 40 from dual union all
  select 4, 1, 45 from dual union all
  select 5, 2, 15 from dual union all
  select 6, 2, 20 from dual union all
  select 7, 2, 20 from dual union all
  select 8, 3, 20 from dual)
select u.*,
       case
         when u.assign = 2 then u.max_qty
         when u.assign = 1 then 0
         when u.assign = 0 then 0
       end as assigned_qty
from
    select v.*,
           case
             when 60 - sum(v.max_qty) over (order by v.box_group, v.max_qty, v.box) >= 0
               and v.rem_items_before >= 0 then 2
             when 60 - sum(v.max_qty) over (order by v.box_group, v.max_qty, v.box) < 0
               and v.rem_items_before > 0 then 1 else 0
           end as assign
    from
        select w.*,
               w.rem_items_after + w.max_qty as rem_items_before
        from
            select x.*,
                   60 - x.qty_assigned as rem_items_after
            from  
                select y.*,
                       y.max_qty * y.rem_boxes as total_cost,
                       sum(y.max_qty) over (order by y.box_group, y.max_qty, y.box) as qty_assigned
                from 
                    select z.*,
                           count(*) over (partition by z.box_group order by z.max_qty, z.box asc range between current row and unbounded following) as rem_boxes
                    from z
                  ) y
              ) x
          ) w
      ) v
  ) uKind regards,
Metro
Edited by: 858378 on 30-mei-2011 4:39
Edited by: 858378 on 30-mei-2011 5:05

Hi, Metro,
858378 wrote:
Hello, thanks for your help so far.
The course I am in, teaches you how to use the basic pl sql language such are selecting from tables.Is it about PL/SQL or SQL?
I have learned things about
- SELECT
- FROM
- WHERE
- GROUP BY
- ORDER BY
- SUB SELECTION IN SELECT
- SUB SELECTION IN FROM
- SUM, COUNT, MIN, MAX
- CASES
- INNER, OUTER, LEFT, FULL, CROSS JOINSAll of these are parts of the SQL language, not PL/SQL.
We are now at partitioning.Are you specifically at partitioning, or iare you at a point where the book talks about analytic functions, which sometimes, but not always, have a PARTTION BY clause?
It's written in Dutch, I tried to translate it, so it might not be well written English.
Excercise 192
Distribution center 'One by one' wants to automate the distribution process.
Items are distributed to the boxes one by one. Sorry, I can't figure out what Exercise 192 is, based on just that.
It is similar to the next excercise, but this above was a lot more straight to the point.
*Excercise 193*
Distribution center 'All in one box' wants to automate the distribution process.
One of the major changes in this process is to distribute items equally to all boxes in the same group.
This means starting from the lowest quantity, assign the lowest quantity to all boxes in the same group if possible.
If this is not possible distribute the amount of items divided by the number of boxes in the same group. If the amount of items per box is lower than 1 and not 0.
Divide the remaining items per box ordered by the box with the highest quantity, till there are no items left.
When it is possible to distribute the lowest quantity to all boxes, move up to the next box in the same group.
When all boxes in the same group are filled to their maximum quantity, move up to the next group and repeat this process. ...
So Exercise 193 is what you asked yesterday, right?
A) Order the following information by box_group and max_qty as described.
B) Calculate the distribution results for 60, 120, 170 items.
When I have 60 items, the following output result should be
box box_group max_qty assigned_from_60
1   1         10      10  
2   1         15      15
3   1         40      17
4   1         45      18
5   2         15      0
6   2         20      0
7   2         20      0
8   3         20      0Box 1 and 2 can be filled completely as you can fill atleast 10 to box 1,2,3,4 and an additional 5 to box 2, 3 and 4.
The last item goes to the box 4.
when I have 120 items
box box_group max_qty assigned_from_120
1   1         10      10  
2   1         15      15
3   1         40      40
4   1         45      45
5   2         15      3
6   2         20      3
7   2         20      4
8   3         20      0
Based on what you posted, it seems like the following should be equally acceptable:
box box_group max_qty assigned_from_120
1   1         10      10  
2   1         15      15
3   1         40      40
4   1         45      45
5   2         15      3
6   2         20      4
7   2         20      3
8   3         20      0That is, the last 10 items have to be distributed among the 3 boxes in box_group=2 as equally as possible. So one box will get 4 items and the others will get 3. The extra item will go to the box with the highest max_qty, but in this case, there is a tie: box 6 has just as much of a claim to having the highest max_qty as box 7. The line marked "***** Add if needed *****" in the query blow guarantees that, in case of a tie like this, the box with the higher box value will be considered "larger" than another box with the same max_qty.
when I have 170 items
box box_group max_qty assigned_from_170
1   1         10      10  
2   1         15      15
3   1         40      40
4   1         45      45
5   2         15      15
6   2         20      20
7   2         20      20
8   3         20      5
I accidentally posted the wrong query yesterday. This is what I should have posted:
WITH     cntr     AS
     SELECT     LEVEL     AS n
     FROM     (  SELECT  MAX (max_qty)     AS max_max_qty
             FROM    z
--             WHERE   box_group     = :target_box_group          -- *****  Removed  *****
     CONNECT BY  LEVEL  <= max_max_qty
,     got_r_num     AS
     SELECT     z.box
     ,     c.n
     ,     ROW_NUMBER () OVER ( ORDER BY  box_group          -- *****  Added  *****
                               ,            c.n
                         ,         z.max_qty     DESC
                         ,            box          DESC     -- ***** Add if needed  *****
                       )     AS r_num
     FROM     cntr     c
     JOIN     z          ON c.n     <= z.max_qty
--     WHERE     z.box_group     = :target_box_group               -- *****  Removed  *****
,     got_assigned     AS
     SELECT       box
     ,       COUNT (*)     AS assigned
     FROM       got_r_num
     WHERE       r_num     <= :total_items
     GROUP BY  box
SELECT     z.*,     NVL (a.assigned, 0)     AS assigned
FROM          z
LEFT OUTER JOIN     got_assigned     a  ON     z.box     = a.box
ORDER BY     z.box_group
,          z.max_qty
;Yesterday, I described how you need to remove 2 lines and add 1, but the code I posted was the unchanged query. The query above is what I should have posted then. Look for comments beginning "*****" above for the changes. I apologize for my mistake.
This query gets the results you posted for all 3 values of :total_items that you posted. If it doesn't work for some other value, or some other data, post the new values and the correct results you want from them, and point out where the query above is wrong.
C) Sum the maximum quantities per group
D) Get the amount of boxes in each group
E) Create a column for remaining boxes per group
F) For each distinct quantity, count the amount of boxes with this quantity
G) Calculate how many items are required to fill all boxes in the same group
H) Create a plan how to solve this distribution problem described in the introduction?
I) Solve this problem using your plan.Are these the steps that the book suggests using?
I don't understand that approach. It might be a good way to solve the problem without using a computer. It might be a good way to solve the problem using a procedural language, such as PL/SQL. It might be one way of solving the problem in SQL, but I think it will be more complicated and less efficient than what I psoted.
The approach above is iterative; that is, you repeat certain steps, with different values. For example, you distribute a certain number of items to all boxes in a box_group. The you remove the smallest box(es) from the group, and repeat, distributing the remaining items among the remianing boxes. That's not hard to do in a language like PL/SQL, where you have loops and variables. In SQL, the closest thing to that is the MODEL clause. I'm sure you could write a MODEL solution to this problem, but, if your book hasn't mentioned MODEL yet, then that's certainly not what it's expecting you to do.
Even using the approach in steps A) trhough G) above, I don't see how a PARTITION BY would help.

Similar Messages

  • I use "element 12" and want  like in the old PS version due Automating and Contact  II upload multiple filesand print them with any columns and rows on the same page . How does it work?

    I use "element 12" and want  like in the old PS version due Automating and Contact  II upload multiple filesand print them with any columns and rows on the same page . How does it work?

    Can you supply a link?

  • How to enter a data into the specified column and row in a created table

    Hi,
    I want to enter some data to specified column and row in a already created table. Please let me know how to do this.
    Regards
    Shivakumar Singh

    A table is just a 2D array of strings. Keep it in a shift register and use "replace array element" to modify the desired entry programmatically.
    If you want to modify it manually and directly from the front panel, make it into a control and type directly into the desired element. (In this case your program would need to write to it using a local variable).
    Atttached is a simple example in LabVIEW 7.0 that shows both possibilities.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChangeTableEntries.vi ‏41 KB

  • Read words from text file by delimiter as columns and rows

    Hi All,
    I need your help as i have a problem with reading string by delimiter. i have used various tech in java, but i can not get the result as expected.
    Please help me to get the string from text file and write into excel . i have used a text file.
    problem
    get the below as string by delimiter
    OI.ID||'|'||OI.IDSIEBEL||'|'||OI.IDTGU||'|'||OI.WORKTYPE||'|'||OI.UTR_FK
    read the below as string by delimiter
    "50381|TEST_7.15.2.2|09913043548|Attivazione|07-SEP-10
    now i need to write the above into excel file as columns and rows.
    there are 5 columns and each corresponding values
    the outut excel should be
    OI.ID OI.IDSIEBEL OI.IDSIEBEL OI.WORKTYPE OI.UTR_FK
    50381 TEST_7.15.2.2 09913043548 Attivazione 07-SEP-10
    i tried in diffrerent techinq but not able to get the resule. pls help me
    Thanks,
    Jasmin
    Edited by: user13836688 on Jan 22, 2011 8:13 PM

    First of all, when posting code, put it between two tags.
    Second of all, the pipe is a special character in regex, so you need to escape it as
    .split("\ \|");
    Erh. So 2 backslashes before the pipe character. Stupid forum won't post it.
    Edited by: Kayaman on Jan 24, 2011 9:35 AM
    Edited by: Kayaman on Jan 24, 2011 9:35 AM
    Edited by: Kayaman on Jan 24, 2011 9:36 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Can we hide the lines between the columns and rows of an alv in wd abap

    HI all ,
      I know that we can colour cell/column/row in an alv in wd abap.
       but, can we hide the lines between the columns and rows of an alv in wd abap.
         i have checked this link [hiding lines b/n rows and columns of an  alv|http://help.sap.com/saphelp_nw04/helpdata/en/91/e7eb40c4f8712ae10000000a155106/content.htm]
         but didn't  understand, can please anybody provide some example or any material..? it will be very helpful.
                                                                         THANK  YOU.
    Edited by: arfat111 on Feb 15, 2010 7:05 AM

    Code some like this in the WDDOINIT method of your view which defines the ALV component as used component.
    instansiate the ALV component
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage = wd_this->wd_cpuse_usage_alv().
    if lo_cmp_usage->has_active_component() is initial.
       lo_cmp_usage->create_component().
    endif.
    data lo_interfacecontroller type ref to iwci_salv_wd_table.
    lo_interfacecontroller = wd_this->wd_cpifc_usage_alv().
    data lo_value type ref to cl_salv_wd_config_table.
    lo_value = lo_interfacecontroller->get_model().
    hide the grid lines
    lo_value->if_salv_wd_table_settings~SET_GRID_MODE( value = '01' ).
    Thanks,
    Abhishek

  • Creating even columns and rows in flash

    I need to create a grid in flash using the drawing tools. The
    grid has multiple (10+) columns and rows. Other than using the
    ruler and guides is there a way to ensure even spacing with columns
    and rows?

    Create the lines for the columns and locate the two end lines
    where they need to be using the Properties panel X positioning.
    Then, with the remaining lines placed between the two end lines,
    select all the lines and use the align tool to space them evenly.
    Do similarly for the row lines, but on a separate layer. You can
    move them to the column layer afterwards.

  • Switch columns and rows in SSRS

    Hi,
    I have a report with static columns that looks something like this:
    Date                     
    Column 1            
    Column2             
    Column30
    December 1      
       xxx                     
        xxx                    
        xxx
    December 2        
     xxx                     
        xxx                    
        xxx
    December 31      
    xxx                      
        xxx                    
        xxx
     It is based on SP that produces a temporary table exactly the same way as the report output (my Dec
    1 to 31 rows are details that are precalculated within SP).
    I need to switch columns and rows as my report is getting too wide.
    Does anyone know how it is done in SSRS 2005 (with SQL 2005 data source) without re-writing my SP?
    Thank you in advance!

    Thank you for your reply Jason.
    Unfortunately I do not have tablix within SSRS 2005; I only have matrix and table. For the original report I am using table as it displays data exactly the way it
    is passed from the SP. You cannot switch columns and rows within the table. I tried matrix, but it didn’t work either… Is there any work around that you know of?
    Thanks again!
    Lana

  • FREEZE COLUMNS AND ROWS IN WEB REPORT - PLEASE ADVISE ME

    Hi Experts,
    I have a web template that contains a query. My customer wants to freeze columns and rows in this report like we do in Excel. I know that in BW 3.5 this is not a standard feature of Table item. In forum I have found some messages regarding with this issue. I inserted a JavaScript code that I have found in forum, but this does not help. A codewriter wrote some other JaveScript for example  alert(), that works but some part of taken code from forum such as defined functions do not work.
    Other solutions advised in forum such as fixing row numbers or column numbers do not fix my problem.
    My questions:
    1 -  In new version of BW, BI 7.0 have this issue with WAD in standard been solved?
    2 - Does it really possible at the same time rows and columns to freeze? I want to freeze 2 rows from top, 2 columns from left.
    Could anyone have an idea?
    Best regards,
    Songul

    Hello,
    This will be implemented with SPS13.
    https://websmp204.sap-ag.de/~sapidb/011000358700004483762006E
    And before SPS13, i frame is useful to realize what you want to do. Using 2 "Analysis" web item. and display of 1st analysis web item is restricted only thin the header of the table and the 2nd Analysis web item is used as "table". display of this "analysis" is also restricted to 10 - 30 rows.
    but this consume hardware resource.
    <sample>
               <div style="OVERFLOW: auto; WIDTH: 1000px; HEIGHT: 20px" >
                   <bi:ANALYSIS_ITEM name="ANALYSIS_ITEM_2" designwidth="400" designheight="20" >
                       <bi:DATA_PROVIDER_REF value="DP_1" />
                       <bi:NEW_LINES_COUNT value="0" />
                       <bi:NEW_LINES_POSITION value="TOP" />
                       <bi:DATA_ROW_FROM value="1" />
                       <bi:DATA_ROW_TO value="0" />
                   </bi:ANALYSIS_ITEM>
               </div>
               <div style="OVERFLOW: auto; WIDTH: 1000px; HEIGHT: 200px" >
                   <bi:ANALYSIS_ITEM name="ANALYSIS_ITEM_1" designwidth="400" designheight="200" >
                       <bi:DATA_PROVIDER_REF value="DP_1" />
                       <bi:DATA_COLUMN_FROM value="1" />
                       <bi:DATA_ROW_TO value="0" />
                   </bi:ANALYSIS_ITEM>
               </div>
    Kind regards,
    Masaaki

  • Transpose columns and rows in numbers

    I need to transpose columns and rows in Numbers and I do not want to write script to do it.  Is there an easier way?

    Give me a proper transpose and I will uninstall Excel and never look back.
    Ok, here's a proper transpose, that can be placed in an Automator Service so it becomes a simple menu pick as below (and can also be assigned a keyboard shortcut).
    To use it (this is slightly different from Excel) you select the range you want to transpose, choose Copy Transpose, click a destination cell in an existing table in the current document or another document, and command-v (Edit > Paste) or option-shift-command-v (Edit > Paste and Match Style).
    The one-time setup is as follows.  In Automator choose File > New > Service,  drag a Run AppleScript action from the left into the right pane, choose 'No Input' for 'Services receives selected' and 'Numbers' for 'in'. Then paste the following into the Run AppleScript action, replacing all text already there by default:
    --Transpose - select range, run, paste transposed values where wanted
    try
              tell application "Numbers" to tell front document to tell active sheet
                        set selected_table to first table whose class of selection range is range
                        tell selected_table
                                  set my_selection to the selection range
                                  set first_col to address of first column of my_selection
                                  set last_col to address of last column of my_selection
                                  set first_row to address of first row of my_selection
                                  set last_row to address of last row of my_selection
                                  set str to ""
                                  repeat with i from first_col to last_col
                                            repeat with j from first_row to last_row
                                                      set str to str & (value of cell j of column i of selected_table) & tab
                                            end repeat
                                            set str to str & return -- add line return after row
                                  end repeat
                        end tell
              end tell
      set the clipboard to str
              display notification "Ready to paste transposed values" with title "Numbers"
    on error
              display dialog "Select a range first and then try again"
    end try
    --end script
    Hit the compile "hammer" and the script should indent properly. Then save the service with the name you want to appear in your menu, and it will thereafter be available via the Services menu (and keyboard shortcut, if you set one up in System Preferences > Keyboard > Shortcuts > Services).
    That's it. Less then five minutes' one-time set-up work and you've got a menu pick for a transpose functionality that is as convenient as Excel's.
    SG

  • How to make Column and Row headers bold in Web template?

    Hi Experts,
    I have a web application with a query in it. Now I would like to know how I could make the column and row headers of this webquery in bold font? I havent found any properties in any web item to make this possible. It looks like the only way to do this is CSS, but i dont have any experience with style sheets.
    Are there easier ways to do this?
    Thanks in advance.
    Rgds,
    Richard

    Tried this for fun using JavaScript.  It appears to work, but is pretty much a hack, and I didn't test it thoroughly.
    Place this in a function that is called during onload of the page:
         var eleid='';
         for(var ct=0;ct<1000;ct++) {
              eleid='ANALYSIS_interactive_mc'+ct+'_tv';
              if (document.getElementById(eleid)) {
                   if(document.getElementById(eleid).parentNode.className=='urLayoutPadless') {
                        document.getElementById(eleid).style.fontWeight='bold';

  • Can I paste and keep the same columns and rows?

    Paste problems. I regularly download data from the Transport for London, Oystercard website. When I used Windows I could highlight and copy on their webpage (displayed in columns and rows) and when I pasted into Excel it pasted the data in the same format (columns and rows). With iPages when I try this it pastes everything into a single downwards column. Paste and Match style does not seem to alter this just the font etc. Am I able to paste in iPages in the same format as I copy.

    I'm guessing you're using Safari to access the web site. The problem is with Safari, not Pages (no "i") or Numbers. Safari just doesn't "understand" tables in web pages & puts lots of spaces and/or returns instead of the needed tabs. I long since gave up & use Camino or FireFox for copying the tables to Numbers or any other program I want the data separated by tabs. There are some web sites, Discover Card is one, that appear to have tables but the data doesn't copy as such.

  • Eliminating Columns and Rows

    I have a spreadsheet. Latitudes are across row 1. Latitudes are across row A. The
    lower case letters are values of some function. I would like to delete all the columns and rows in the spreadsheet except for those that are closest to .00, .25,.50, .75.
    For example, this
    A
    B
    C
    D
    E
    1
    -91.5125
    -91.5042
    -91.4959
    -91.4875
    2
    42.52124
    a
    b
    c
    d
    3
    42.5129
    e
    f
    g
    h
    4
    42.50457
    i
    j
    k
    l
    5
    42.49624
    m
    n
    o
    p
    would turn out to this...
    A
    B
    1
    -91.4959
    2
    42.49624
    o
    How would I go about doing so?

    Thanks Jerry,
    sure wish this was easy to access in the help menu or on the web. not burried deep in a huge manual that is burried deep in the website. 
    For others who might read this, the corner square is called a "Table Handle"
    The A, B, C row is called "Reference tab letters" and can be used to refer to columns.
    The 1, 2, 3 column is called "Reference tab numbers" and can be used to refer to rows.
    http://manuals.info.apple.com/en_US/Numbers09_UserGuide.pdf

  • How to fix skewed table columns and rows after re-import XML

    My question is regarding XML Import in InDesign CS3.
    I have a XML that has a table of 5 columns and 5 rows, when I import it into InDesign, the table shows up fine with 5 columns and 5 rows. However when I revise my table to have an additional column, and re-import the XML file, the table gets updated, but instead of with an additional column, it gets 'appended' with an additional row instead (InDesign seems to blindly replace each cell from left to right, top to bottom, and ends up with 6 rows instead). The XML file specifies the number of columns and rows (5 and 5 before, 5 and 6 after), why doesn't InDesign recognize it and automatically add a new column when I re-import the file?  Is this problem fixed in CS5.5? Is there a script to fix this?
    Here is an example of my old XML vs new XML:
    Old:
    <frame5>
    <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="5" aid:tcols="5">
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1"></Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2006</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2005</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2004</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2003</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores at beginning of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">678</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores opened during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">36</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">50</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">59</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">79</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores closed during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">13</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">9</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">7</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">4</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Total stores at end of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">869</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    </Table>
    </frame5>
    New:
    <frame5>
    <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"
    xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="5" aid:tcols="6">
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1"></Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2007</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2006</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2005</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2004</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2003</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores at beginning of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">123</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">678</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores opened during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">456</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">36</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">50</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">59</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">79</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores closed during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">789</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">13</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">9</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">7</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">4</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Total stores at end of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">1368</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">869</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    </Table>
    </frame5>

    What I mean is, right now there is a "workaround" which requires a user to manually add an extra column before re-importing the XML (with an extra column), otherwise the results get skewed. If by providing a script we can simply ask the user to "run" it, it would be a more "acceptable" solution.  
    Right. So, one solution would be to use Convert Text to Tables. If you find that works for you, then you can script it.
    That's why I asked you...
    Of course if nothing is required from the user other than simply re-importing, then that would be the best solution.
    Well, one could imagine a script that was attached to the re-import command, or to the link update notification, but probably the first step is to get something that works reasonably well without automating it completely. Especially because triggers to run scripts silently can introduce hard-to-debug problems.
    Sure we can switch to use "CALS table and see if this works. The question is, why should we need to? In the 2nd XML there is clearly a different "aid:tcols" value, and yet InDesign seems to ignore it and assume the same # of columns? This sounds like an Indesign bug, can someone confirm? Is there any plans to fix this?
    Not to be snarky, but do you want it to work or not? There are the tools you have and the tools you wish you had, and you can't really do much with the ones you wish you had. I'm kind of assuming you are looking for a solution today, not a solution in 2013.
    Yes,  I believe two of us have confirmed this appears to be a bug.
    Plans to fix? Well, we can't really tell you. You could try asking Adobe, but that's not easy information to get out. But you can certainly open a support case at http://adobe.com/go/supportportal and ask. It's not like we have special information here...
    But you're probably better off filing a bug first, in that same fashion.
    But let's assume no one had filed the bug. CS6 is expected in the March/April 2012 timeframe. That means that they're probably just putting the finishing touches on it right now, and it's going to be very difficult to fix things in it now. So then the earliest you'd likely get it fixed in CS6.5/CS7/whatever which presumably comes out by 2Q2013, and that's assuming Adobe decides to fix it...
    I also can't find much documentation on how to update my table to a "CALS table", any examples?
    Try this thread:
    Re: Importing a CALS table into InDesign CS3

  • Lock first column and row of a grid so they don't scroll of the screen

    Hello,
    In a flex app we use a grid with repeaters to build it dynamically depending on a datafeed. But we need the first row and column to stay always on the screen. Any ideas on how to do this ? Did a search for an example but couldn't find anything like it.
    I know it exists for a datagrid, but can't find any similar for a grid...
    http://flexonblog.wordpress.com/2008/04/22/lock-columns-and-rows-in-datagrid-for-visibilit y/
    Thanks for any ideas!
    Frank

    Doesn't exist for Grid container.  You might just remove the first items from the dataProvider and place them outside the Grid.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Is  it possible  to get  column and rows in the output

    i reading a file and writing toa nother file.i want output as column and rows as given in the following format is it possible in java
    Ticket| System | order
    456 | machine |678
    457 | machine1 |690
    correspondoing ticket no comes only in corresponding header ticket no..please explain with code..the out put file may be.txt extension
    Message was edited by:
    loveme

    Hi,
    have a look at the Formatter class:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
    There are also convenience methods e.g. in String:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#format(java.lang.String,%20java.lang.Object...)
    or - if you use System.out for example -
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/PrintStream.html#printf(java.lang.String,%20java.lang.Object...)
    -Puce

Maybe you are looking for

  • Error while defining the Payroll

    Hi All, I am getting an error while savng the details. It is showing an errror 'Please enter the required value for the employers PAYE Reference segment in the GB statutory info flexfield. Aslo another error is i have created the Payment method but i

  • After upgrade from 3.6.28 to 12.0 I lost bookmark functionality

    OS is Windows XP 64-bit SP2. Upgrade from version 3.6.28 to version 12.0 doesn't work properly because I lost bookmark functionality. Bookmark menu is there, but no bookmark entries. - I tried to add a bookmark (visit a page, then 'bookmark this page

  • Windows 7 DNS and Group Policy Issues

    Hi, We have several suites of Windows 7 domain connected PC's. In one of the suites I have been called into look at 3 different PC's where the users have not got mapped drives, desktop backgrounds, internet connectivity - because their group policies

  • Acrobat 10.3.1 Crash while Printing

    To whom it may concern: At present, I am running Adobe Acrobat 10.1.3 and Reader 10.1.3 on Mac OS X Lion 10.7.4. Every time I attempt to print on either program, the application crashes and delivers the following message. What should I do? Process:  

  • Power vs Temperature Graph

    I need to plot power/current  vs temperature on a graph from data collected by another program.  The program runs from -10C to 60C, back to -10C, then goes to 60C, and finally returns to 25C.  The collecting program stores time, temperature current,