Many line by line calculations

Hi All,
I have a component with couple methods, each method is the result of query from the database.
I want to do some calculations after i get the data from the server. I am lokking for a solution with good performance because I have many calculations to do.
Code:
<cfset myObj = CreateObject("component", "cfcs.myComponent") />
<cfset firstQry = myObj.getFirstResult(arguments.A, arguments.B) />
<cfset secondQry = myObj.getSecondResult(arguments.A, arguments.B) />
Both query results have the same structure myID, myDesc, year_1, year2, year3
firstQry have 10 rows, how can I sum the years row 3 (myID = 3) and years row 5 (myID = 5) ?
and add the result of the calculation into firstQry as line 11 (new myID = 11).
secondQry have one row result.
How can I multiple the firstQry years row 4 (myID=4) with the secondQry years row 1 (only row myID = 1)? 
and add the result into firstQry as line 12 (new myId =12).
I was thinking to use query of query but I wondering if it is a better way to do this.
Thanks in advance for your help.
Best,

Q of Q have many limitations. I have to generate a lot of code.
If I want to do the first calculation, i have to create another query because I cannot use query table alias like:
<cfquery dbtype="query" name="firstQry2">
select * from firstQry
</cfquery>
<cfquery dbtype="query" name="qryResult">
select 11 as myID, 'cal 12' as myDesc
<cfloop from="1" to="3" index="y">
,(firstQry.year_#y# + firstQry2.year_#y#) as year_#y#
</cfloop>
from firstQry, firstQry2
where firstQry.myID = 3
and firstQry2.myID = 5
</cfquery>
Is this correct, or I can do this in a better way?
Now, how can i insert the result into firstQuery?
I try to do another Q of Q with insert but I am getting an error.
Query Of Queries syntax error.
  Encountered "insert. 
<cfquery dbtype="query" name="insertQry">
insert into firstQuery (myID, myDesc
<cfloop from="1" to="3" index="y">
,year_#y#
</cfloop>
select  myID, myDesc
<cfloop from="1" to="3" index="y">
,year_#y#
</cfloop>
from qryResult
</cfquery>

Similar Messages

  • I am trying to create a PDF document that calculates Gains and Losses in Mutual Funds. The calculation scripts are repetitive from line to line. The scripts work well until I reach the line 32. Script stops calculating...

    I am trying to create a PDF document that calculates Gains and Losses in Mutual Funds. The calculation scripts are repetitive from line to line. The scripts work well until I reach the line 32. Although I am using the same script as the fields above in the columm, the script eventually stops calculating and I can't figure out why. Is there a limit of how many calculation scripts you can enter? I will attempt to attach my pdf as soon as I figure out how. Thanks.

    For e31 :
    var e30 = +getField("e30").value ;
    var c31 = +getField("c31").value ;
    if ( (e30 !== 0) && (c31 !== 0) ) event.value = e30 + c31 ;
    else event.value = "";
    for e32 :
    var e31 = +getField("e31").value ;
    var c32 = +getField("c32").value ;
    if ( (e31 !== 0) && (c32 !== 0) ) event.value = e31 + c32 ;
    else event.value = "";
    for e33 :
    var e32 = +getField("e32").value ;
    var c33 = +getField("c33").value ;
    if ( (e32 !== 0) && (c33 !== 0) ) event.value = e32 + c33 ;
    else event.value = "";
    Java console doesn't show any error... That's why I am wondering if it's not a limitation issue... or memory issue, because they are maybe too many rows or something....
    The c value is not calculated.

  • Combining quantities of Two line items while calculating Free goods qty

    Hi,
    Scenario is: On every sales of 50 pieces( 50 pieces can be of different material like Mat A and Mat B) in single sales order,
    5 pieces ( of Material A) should be given as Free goods.
    Means: I want to total the quantities of all the line item before calculation of the Free goods.
    Is it possible in SAP if yes, how to do it?
    Regards
    Gaurav

    Hi,
    I have one solution but I have not tried it. You can try.
    What you can do is to group all the materials for which you want to give free goods
    Add new field Material group from field catalogue to Condition table - create new condition table
    create access seq and put this table in it, put acc. seq in cond. type, assign it to free goods determination
    Create condition record, enter this material group and qty., I guess here system will total the qty of all the materials that you will enter in sales order assuming you have assigned mat. group in respective material master
    Try this and post your feedback
    If it works, it will be good for all friends having similar req.
    regards,
    Sagar

  • I need to convert PDF to Excel, however, columns and tabs make many merged cells and many blank columns. In addition to not separate the columns correctly, I see many not separate lines together in the same cell. I'm even thinking that Adobe Acrobat Pro D

    I need to convert PDF to Excel, however, columns and tabs make many merged cells and many blank columns. In addition to not separate the columns correctly, I see many not separate lines together in the same cell. I'm even thinking that Adobe Acrobat Pro DC has limitations. There is no way to define what points in columns to force break column? Nor create many columns that are useless? How does text to column in Excel, fixed size when we import text, and define where the breaks have columns?
    Google Tradutor para empresas:Google Toolkit de tradução para appsTradutor de sitesGlobal Market Finder
    Desativar tradução instantâneaSobre o Google TradutorCelularComunidadePrivacidade e TermosAjudaEnviar feedback

    PDF does not contain columns, rows, formats, styles, or other aspects of word processing or spreadsheet file formats.
    This is because PDF is decidedly not a word processing or spreadsheet file format or something "like" one of those.
    (see ISO 32000 for what PDF "is")
    What can optimize the export of PDF page content is to start with a well-formed tagged PDF (ISO 14289-1, PDF/UA-1 compliant).
    Without that export is what it is and one performs whatever content cleanup is needed using the native application for the export file (MS Word or Excel).
    Be well...

  • VENDOR LINE ITEM INTEREST CALCULATION

    Hi Friends.
    I configured all the settings relating to the line item interest calculation on vendor line items with interest calculation frequency as 1 month.
    When I run the program for the first month by using T.code F.47 by specifying the from date and to date, the system is calculating interest amount correctly but when I run the same program for the second month by specifying the from date and to date, the system is calculating interest for the current month as well as the previous month.
    Please respond.
    Regards.
    Srini

    Hi Venkat,
    The system takes the open items into consideration when calculating the interest. May be the open items that were there in the first month still continue to be existing during the current month also.  Try clearing some of the previous month's open item and run the program.  You should see some difference in the interest calculation.
    Thanks,
    P.k

  • Line by Line Tax Calculation

    Hi Freinds,
    I want to see line by line tax calculation on document level at the time of postings. i have made a required settings but now system always prompt for Tax Jurisdiction. Earlier system was not asking for Tax Jurisdiction at posting level.
    We are usgin TAXINJ procedure.
    I am looking for any further settings if required other than the "structure of Tax Jurisdiction" in IMG which allows line by line tax calculation.
    Thanks,
    Raj

    Thanks a lot,
    now i can see the line by line tax calculation. but is there any way to avoid entering Tax Jurisdiction Code everytime in the line item.
    Also i would appreciate if i can know the impact of entering the Tax Jurisdiction Code in line item.
    Regards,
    Raj

  • Satellite M307 - many dots and lines on the screen

    I bought this new pc in China half year ago,
    However, when I move the screen today, there are always many dots and lines on it.
    But if I don't touch it, it will be OK. I think it may be caused by the connection between screen and main physical system. Please contact with me: [email protected]
    Thank you!

    Hi!
    I agree with you that is a connection problem or the display is faulty.
    I think your notebook must be still under warranty so I would go to a local ASP.
    They can order all necessary parts and exchange it.
    Bye

  • How to store data in the text line by line?

    when i write the data into *.txt, the data I wrote before is deleted.
    how can wrote the data into the txt following the existing data?
    how to write data line by line? many thanks!
    my code is like:
    private String text = "i am yanbo du, i am a boy.";
    public BufferWriteMultiKey( ) {         
         try {
              StringTokenizer st = new StringTokenizer(text, " ,.");
              File fil =new File("f.txt");
         //FileWriter fw = new FileWriter(fil);
         //BufferedWriter bw= new BufferedWriter(fw);
         DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fil)));
    while(st.hasMoreTokens())
    String s = st.nextToken();
         //bw.newLine();
         out.writeChars(s);
    out.writeChars("\n");
    out.close();

    use a random access file and append text at the end.
    read the file in line by line using a BufferedReader and store each line in a List of Strings, of course.
    %

  • Read a specific line of a txt file using vba not using line by line, Leer una Linea especifica de archivo de texto sin recorrer linea por linea

    Buenos días - Good morning
    Mi pregunta la escribiré en español y en ingles y espero alguien tenga la solución.
    I'll write my question in Spanish and English and I hope someone has the solution.
    SPANISH
    Creé una Macro en VBA que lee mas de 200.000 archivos de texto (.txt) los cuales tienen diferentes tamaños y cantidad de información dentro de ellos, de cada archivo necesito extraer la información de las 3 primeras lineas y las ultimas 10 lineas, las 3
    primeras lineas es fácil ya que uso un "READLINE" 3 veces y voy capturando la información de las tres primeras lineas, para las ultimas 10 lineas las cuales están identificadas por un código inicial hago un ciclo que lee linea por linea hasta que
    encuentra el numero 3 en un espacio especificado de la linea y de ahí captura la información de cada linea de texto que serian las 10 ultimas, el problema que tengo es que la cantidad de archivos y de información dentro de los archivos aumenta considerablemente
    cada día y por tener el ciclo que lee cada una de las lineas de cada archivo de texto la Macro se demora cada vez mas a medida que aumenta la información y consume cada vez mas memoria de la maquina.
    Necesito un método diferente que no lea linea por linea y que yo le pueda decir lea la linea (renglón) numero 1000 (ejemplo) y capture la información a partir de ahí para ahorrar algo de tiempo, o saber cuantas lineas de texto tiene el archivo .txt y decirle
    que me lea a partir de (numero total de lineas del txt -(menos) 10 lineas) así me leería las 10 ultimas.
    ENGLISH
    I created a Macro in VBA that reads more than 200,000 text files (.txt) which have different sizes and quantity of information within them, each file need to extract the information from the first 3 lines and last 10 lines, 3 first lines is easy as using a
    'READLINE "3 times and am capturing information from the first three lines, for the last 10 lines which are identified by an initial code I make a loop that reads line by line until it finds the number 3 in a specified area of ​​the line and then capture
    the information of each line of text that would be 10 last, the problem that I have is that the number of files and information within files significantly increases every day and having the loop that reads each line of each text file is delayed Macro increasingly
    as more information and consume more and more memory on the machine.
    I Need a different method not read line by line and I can tell you read the line (row) number 1000 (example) and capture the information from there to save some time or know how many lines of text have the file .txt and tell me read from (total number of lines
    of txt - (minus) 10 lines) so I would read 10 last.
    Here is the code I currently use
    Dejo el código que uso actualmente
    Dim fs, f, ts, REG
    Set fso = CreateObject("Scripting.FileSystemObject")
        On Error Resume Next
    sFilePath = strFolder & "\" & strFileName
    Set f = fso.getFile(sFilePath)
    Set ts = f.OpenAsTextStream(1, 0)
    REG = ts.READLINE
    Ciclo para llegar hasta las ultimas 10 lineas
    Cycle to reach the last 10 lines
    For J = 1 To 200000
                REG = ts.READLINE
                    If Val(Mid(REG, 6, 1)) = 3 Then

    Good Morning ryguy72
    First thank you so much for your answer, sorry for my english in the question, I tried for a long time to make a code that wasn't so slow to read the last 10 lines, 'cuz most codes used a cycle "For" to read line by line asking if in the specific
    position is the character(number) that tells me that i should get started to read the last lines that i need, that takes a lot longer than your code doing a Split with Mydata and storing it in strData(). I don't know how to do this and every forum that
    i consulted to read the last 10 lines quickly they made the same read line by line with a Cycle "for".
    Thanks again, I gonna improve my code with your help, 'cuz it took about 4 hours to read all the information and everyday ascended more time and memory consumption.
    Thanks to everyone who offered their help so disinterested and free, so should always be people with that spirit, I hope someday to be SO good as you programming.

  • How to display values and new char line (blank line)

    Hi,
    In database, one field contains values followed by new character lines (blank lines) after blank lines there is no values. Finally, I would say the field contains values and blank lines. Every thing is fine in database.
    In Crystal Reports the field is displaying only values. Need to display values and blank line.
    User is asking after values new character lines (blank line) to be shown. They enter like that in an application. The user doubt is why report is not showing what they enter in the application.
    In detail explanation, front end tool is ASP.NET and backend is SQL Server.
    User enter some values in note field, after that they hit enter button in the same field, cursor will go next line...user may hit u2018enter buttonu2019 more than 5 times. So note field contain values and some blank lines which are created by after hitting enter button.
    If user opens the application, they could see values plus blank lines in the note field.
    They are fine with the application.
    In Crystal Reports, the note field shows only values.
    User is questioning that why we could not see in report we enter.
    I checked in .Net application and SQL server database it is fine. It is displaying values and blank line.
    Please help me out how to display values followed by blank lines in Crystal Reports - the way they enter in the application.
    Thanks and Regards,
    Manjunath N. Jogin

    Hi,
    Sharonmat,
    I tried as you suggested. It is still displaying only values.
    I would like to explain again.
    it is not exactly null values.
    In .Net application it is called 'new char line'.
    it shows those many lines look like null.
    it is working fine in database.
    Why it is not working in Crystal Reports? I am wondering...
    Thanks for your suggestion.
    Debi,
    User may enter any number of blank lines or they may not enter blank lines.
    That is the reason I can not always give more height or blank text object.
    Thanks for your suggestion.
    Please suggest me some more suggestions,
    Thanks and Regards,
    Manjunath N. Jogin

  • Line By Line Comparison of 2 Html Pages

    Does anyone know of an algorithm that will compare 2 pages together, line by line? Many source control applications have this functionality.

    Does anyone know of an algorithm that will compare 2
    pages together, line by line? Many source control
    applications have this functionality.If you do a web search for "edit difference algorithm", you can find an algorithm for listing the minimal set of differences between two strings, and several faster algorithms for finding a near-minimal set of differences.

  • CF Builder and debugging line by line

    Hi,
    I have been having difficutly getting CFB to do line by line debugging.
    I have a local server using WAMP 2.0 (Apache, CF9 Dev and MySQL)
    I have RDS setup properly and I can get the debugger started on a line. However, it never progress past the Aplication.cfc.
    I am using Coldbox and the debugger always seems to finish after running about 5 lines in the App.cfc.
    I used FusionDebug on another project and I didn't seem to have this problem. I just wanted to make sure I wasn't doing anything wrong or if anyone else has encountered this problem.
    I will be more than happy to give more details if needed.
    Thanks,
    Mal

    It may be very hard to debug this problem (pardon the pun) over a mailing list. Just way to many factors that could influence what's going wrong, but let's try.
    You say you have the debugger running, and you say "started" (did you mean "stopped"?) on a line. That's a great head start. Many can't even get to there due to config issues (getting the server-side config right, getting the RDS and Server properties in CFB right, getting the project properties to point to that, getting the debug configuration properties right, starting a debug session, etc.). So you're on the right track.
    So when you say it "5 lines in", do you mean you're doing step over or into on each? What is the last line where things work? And what happens?
    Could it be simply that the logic flow at that point is finished in the app.cfc? If so, then you'd need to have set a breakpoint in whatever next point you want to stop at. Does that help?
    /charlie

  • Reading file line by line

    I want to read an input file line by line and tokenize only certain lines of the file.
    For example, I want to read in a file, go to the fourth line, tokenize it,and print the 4th and 7th token to an output file.
    Then skip two lines and tokenize the next line, and print the last token to the same output file.
    I want to keep doing this until I reach the end of the file. How can I specify that I want to go to the 4th line, skip two lines, skip two lines again, etc
    Here is my attempt:
    public class Practicing
    public static void main (String [] args)
    try
    //open output stream
    OutputStream fout= new FileOutputStream(Input.readString("Output Filename:"));
    OutputStream bout= new BufferedOutputStream(fout);
    OutputStreamWriter out = new OutputStreamWriter(bout, "8859_1");
    //open input stream
    File inputFile = new File(Input.readString("Input Filename:"));
    InputStream inStream = new FileInputStream(inputFile);
    InputStreamReader inreader = new InputStreamReader(inStream, "8859_1");
    BufferedReader reader = new BufferedReader(inreader);
    String line = reader.readLine();
    int index = 0;
    StringTokenizer st;
    while((line !=null))
          st = new StringTokenizer(line, " ");
    // get the number of tokens and create an Array of that many elements
            int numTokens = st.countTokens();
            String[] strArray = new String[numTokens];
    // assign each token to a 'slot' in the Array
            for (int i = 0; i < numTokens; i++) {
                strArray[i] = st.nextToken();
          System.out.println(strArray.length); // prints array length to out
          //for (int i = 0; i < strArray.length; i++) {
             // System.out.println(strArray);
    out.write(strArray[4] + "&" + strArray[7] + "&");
         line = reader.readLine();
    out.flush();
    out.close();
    catch(IOException e)
    System.out.println("IOException caught");
    System.out.println(e.getMessage());
    Thanks

    String line = "";
    int index = 0,
        counter = 0;  // For counting lines
    StringTokenizer st;
    int[] linesToTokenize = int[] {4,6,999};
    while(( line = reader.readLine() ) !=null)
      counter++;
      st = new StringTokenizer(line, " ");
      for (int i = 0; i < linesToTokenize.length; i++)
        if ( counter == linesToTokenize[i] )  // keeps track of line#
    // get the number of tokens and create an Array of that many elements
            int numTokens = st.countTokens();
            String[] strArray = new String[numTokens];
    // assign each token to a 'slot' in the Array
            for (int i = 0; i < numTokens; i++) {
                strArray[i] = st.nextToken();
          System.out.println(strArray.length); // prints array length to out
          //for (int i = 0; i < strArray.length; i++) {
             // System.out.println(strArray);
    out.write(strArray[4] + "&" + strArray[7] + "&");

  • Calculate a product line by line

    Hello all,
    how can I calculate a product of two key datas line by line? The default is column by column but in this case I get a incorrect result.
    Here is an example what I mean:
    Table 1:
    Month.........Type...... Distance(km)......Weight(kg).........Distance * Weight
    Jan.............Typ_1.............2..........................10...........................20        
    Jan.............Typ_2.............5..........................20.........................100
    Jan.............Typ_3.............4..........................10...........................40
    Sum............................................................................................160    <-- correct Sum
    When I list the key datas only for month I get a different sum(see Table 2)
    How can I get the information in Table 2 with the correct sum of Table 1 ?
    Can you help me to fix the problem ?
    Table 2:
    Month.......Distance (km)....... Weight (kg).................. Distance * Weight
    Jan...................11...........................40...............................440   <-- incorrect Sum

    Hi,
        You have to make use of calculation context functions like 'ForEach' and 'ForAll' to calculate the sum here.
        In the second table, you don't have a product dimension, but you want to calculate it by product dimension. So use ForEach function to include the product dimension in the calculation. Create a new variable and use this function to calculate the sum. If you need more details BO help is one good place where you can find information on these calculation contexts or just google up :).
      Please let me know if you need anymore information.
    Regards,
    Sanjay

  • Crystal report -How to display multiple lines in line chart?

    Hi,
    M struggling to display multiple lines in line chart. All the values m fetching it from database into data table in below format & data type
    Category(String).....year(Int).....graph_values(Int).....table_value(String)
    Test.........................2006.......... -100............................(100)
    Avg..........................2006..........20................................20
    Median......................2006...........5................................5
    Test..........................2007...........500.............................500
    Avg...........................2007............90..............................90
    Median.......................2007............45..............................45
    M using cross tab to display data and chart to plot line. Following fields I used in Cross tab Expert & Chart expert
    Cross tab expert-
    Rows u2013 category
    Columns u2013 year
    Summarized fields u2013 Min of table_value
    In Chart Expert u2013
    On Change of - Year
    Show values - graph values
    In cross tab m able to see the data properly but not in graph.I have three categories. Hence it should plot three lines in line chart but m able to see only one line for test category.
    FYI u2013 using VS 2008 and crystal report assembly version 10.5
    Urgent. Please reply soon.
    Thanks
    ThakurS

    I got the solution.
    In Chart Expert - I should use
    On Change of -- Year, Category
    Show values -- graph values
    Thanks,
    ThakurS

  • Create a Macro to Index a Word Document Line by Line

    Background
    I have collected a bunch of keywords and references to where I can find these words in a textbook.  I've put them into a Word document where each line is one Index beginning with the “Main Entry” followed by a colon and then the “Subentry”.  Note
    that in the "Subentry" I have included my reference in parenthesis (b1-m2).
    Example Original Text:
            Main Entry:Subentry (b1-m2)
    Example Marked for Index:
            Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" \t "" }
    When it was only a page of content it was no big deal to select the entire line and <Ctrl>+<Alt>+<x> then <Enter> down the line.  Now that I have about 500 lines of these word combinations, I need a more automated solution. 
    I have searched for KB articles that explain the various elements I need, though unsuccessfully since I don’t know what I need.  I doubt I am the first person to do this, so if anyone could point me to the right documents I would greatly appreciate
    it.
    As a noob, how difficult of a task is this to automate with a Macro or some other method and should I even attempt it? I have a very short window of time to figure this out.
    Nice to have: In the final index, I don't need the Word page numbering after the term.  My references are in the parenthesis.  I know how to remove it manually in Word, when I mark the index entry: Chose Options, Cross-reference
    and remove the pre-populated text of "see". That adds  \t "" to the index reference. 
    Illustrated as such:
            From: Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" }
            To:     Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" \t "" }
    My Attempt at Recording a Macro
    Having zero experience writing macro’s myself, I tried recorded a simple macro using the manual keystrokes below however the text reflected in the actual index reference does not change.  I also have to manually kick off the macro on every line of text.
    I walked through each of the steps outlined below as I was recording a macro, however when I replay the macro, the index itself contains the exact same text for every line and does not match the original text on the new line.
    I could not get the macro to repeat itself on every line.  I had to keep running it until I was done (technically, when I realized it was repeating the same text within the index reference itself) but I’d like the macro to run from beginning
    to end; line by line and then insert the Index itself at the end on a new page.
    I realize I need some kind of loop to keep the macro going line by line.
    I also need some way to mark the Main Entry within the loop (everything to the left of the colon) and then the Subentry (everything to the right of the colon to the end of the line). 
    Example “Index” Macro
    Sub Index()
    ' Index Macro
        Selection.EndKey Unit:=wdLine, Extend:=wdExtend
        ActiveWindow.ActivePane.View.ShowAll = True
        ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:= _
            "TV\:The Good Wife (y2014-y2015)", EntryAutoText:= _
            "TV\:The Good Wife (y2014-y2015)", CrossReference:="", _
            CrossReferenceAutoText:="", BookmarkName:="", Bold:=False, Italic:=False
        Selection.MoveRight Unit:=wdCharacter, Count:=1
    End Sub
    Manually Marking Index Entries
    Manually, here are the keystrokes I use to iterate my way through the document.
    Manual Index Marking Keyboard Combinations:
    At the beginning of the first line, press <Shift> + <End>
    This selects the entire rows text
    Then press <Ctrl> + <Shift> + <x>
    This allows me to “Mark Index Entry”
    Then press <Enter>
    This confirms the Index entry
    Then press <Esc>
    This closes the “Mark Index Entry”
    Go to the next line and repeat.
    Replacing anchor
    Once the creation of each index is complete, I need to be able to iterate through the document and find all anchor + colons (IE: \: ) and replace with colon (IE: :). This way, the “Main entry” and “Subentry” are handled properly when the Index is inserted.
    Manual Anchor Replacement Keyboard Combinations:
    At the beginning of the Word document, press <Ctrl> + <h>
    Find what:      \:
    Replace with:   :
    Then <Alt> + <a>
    Press the "Ok" button (or make replace silent somehow)
    Then press <Esc>
    This should close the "Find and Replace" screen
    Inserting Index
    Ideally, I would like the macro to create and insert the newly marked content into an index at the end of the document.
    Manually Inserting Index Keyboard Combinations:
    Press <Ctrl> + <End>
    this takes us to the bottom of the document
    Then press <Alt> + <s>
    this chooses the "References" tab
    Next press <Alt> + <x>
    this chooses "Insert Index"
    Next press <Alt> + <t>
    This should allow you to choose a "Format" option for the index
    Next press <m>
    This should chose "Modern" from the "Formats" options
    Finally, press <Enter>
    End the macro
    Example before Indexing:
              TV:The Good Wife (y2014-y2015)
              TV:Phineas and Ferb (y2011)
              TV:Curb Your Enthusiasm (y2011-y2015)
              Game:Back to the Future (y2012)
              Made for TV Movie:The Magic 7(y2009)
              Main Entry:Subentry (b1-m2)
    Example after Indexing is completed:
    The marked up text/references did not transfer over properly from the Word document I copied my question from.  I had to manually type the text within the {} brackets for illustrative purposes here:
              TV:The Good Wife (y2014-y2015){ XE "TV:The Good Wife (y2014-y2015)" }
              TV:Phineas and Ferb (y2011){ XE "TV:Phineas and Ferb (y2011)" }
              TV:Curb Your Enthusiasm (y2011-y2015){ XE "TV:Curb Your Enthusiasm (y2011-y2015)" }
              Game:Back to the Future (y2012){ XE "Game:Back to the Future (y2012)" }
              Made for TV Movie:The Magic 7(y2009){ XE "Made for TV Movie:The Magic 7(y2009)" }
              Main Entry:Subentry (b1-m2){ XE "Main Entry:Subentry (b1-m2)" }
    Example Index 
    G
        Game
              Back to the Future (y2012) · 2
    M
        Made for TV Movie
              The Magic 7(y2009) · 2
        Main Entry
              Subentry (b1-m2) · 1,
    2
    T
         TV
              Curb Your Enthusiasm (y2011-y2015) · 2
              Phineas and Ferb (y2011) · 2
              The Good Wife (y2014-y2015) · 2
    Chris Schurman

    Once I combined my Excel knowledge and Word knowledge, this became a piece of cake.  Sharing my solution for anyone else who may have the need.  The point of this exercise is to prepare for an open book exam and I need a quick index of my books
    (there are 6 for this class).  Anyway, here is how i solved (though slightly clunky, it works in seconds!)"
    In Excel, I pieced the text together by concatenating the indexing markup and the contents of the pertinent cells as such:
        =CONCATENATE("XE """,A2,":",B2," (b",C2,"-p",D2,")"" \t """"")
    Content from Excel (with results of concantenate statement in last column:
    Heading    Slide Title    Book    Page    Copy this into notepad then into word
    Game    Back to the Future    1    12    XE "Game:Back to the Future (b1-p12)"
    Made for TV Movie    The Magic 7    2    7    XE "Made for TV Movie:The Magic 7 (b2-p7)"
    Main Entry    Subentry    3    48    XE "Main Entry:Subentry (b3-p48)"
    TV    Curb Your Enthusiasm    4    100    XE "TV:Curb Your Enthusiasm (b4-p100)"
    TV    Phineas and Ferb    5    20    XE "TV:Phineas and Ferb (b5-p20)"
    TV    The Good Wife    6    35    XE "TV:The Good Wife (b6-p35)"
    Then I paste special the "Values" of the last column into Word.
    I run the macro below (haven't figured out how to loop yet) a few doxen times an insert the index at the bottom.
        Sub Index()
        ' Index Macro
            Selection.HomeKey Unit:=wdLine
            Selection.EndKey Unit:=wdLine, Extend:=wdExtend
            Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
            Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
                PreserveFormatting:=False
            Selection.EndKey Unit:=wdLine
            Selection.MoveRight Unit:=wdCharacter, Count:=1
        End Sub
    Bam; instant Index!
    Chris Schurman

Maybe you are looking for