Posts by mentos123

    Hi,


    I have a data grid on a web page. The first column is a checkbox.



    Code
    1. <td tabIndex="-1" class="ig60e0d7d6 " id="x:558988790.111:val:false" style="width: 20px;" _object="[object Object]" idx="1" adr="1" val="false" type="cell" wlkd="1">
    2. <img title="Unchecked" id="x:558988790.110:chkState:0" alt="Unchecked" src="../../ig_res/Office2007Blue/images/ig_checkbox_off.gif" complete="complete" chkState="0"/>


    I am trying to check the checkbox in any row but am unable to. I have got the handle through

    Code
    1. If InStr(c.className, "ig60e0d7d6") > 0 Then


    but am unable to use the following code.


    Code
    1. If InStr(c.className, "ig60e0d7d6") > 0 Then
    2. targetcheckbox = c
    3. c.FirstChild.Focus
    4. c.FirstChild.Click
    5. c.FirstChild.chkState = 1


    The checkbox does not get marked.


    Please help me check the checkbox.

    Re: Match positive and negative values withing subgroups


    Quote from StephenR;710736

    Yes, it would. I think on reflection I would use VBA for this. You need someone much better than me at formulae if you want that approach!


    Can you post a sample workbook and I will try some code?


    Apologies for the late response. My company network blocks uploading any files so I have pasted a sample.


    [TABLE="width: 188"]

    [tr]


    [td]

    Diwan Furnishings

    [/td]


    [TD="align: right"]235900[/TD]

    [/tr]


    [tr]


    [td]

    VIP Industries

    [/td]


    [TD="align: right"]18000[/TD]

    [/tr]


    [tr]


    [td]

    Diwan Furnishings

    [/td]


    [TD="align: right"]11500[/TD]

    [/tr]


    [tr]


    [td]

    Diwan Furnishings

    [/td]


    [TD="align: right"]-11500[/TD]

    [/tr]


    [tr]


    [td]

    Okaya Batteries

    [/td]


    [TD="align: right"]43700[/TD]

    [/tr]


    [tr]


    [td]

    Diwan Furnishings

    [/td]


    [TD="align: right"]11500[/TD]

    [/tr]


    [tr]


    [td]

    VIP Industries

    [/td]


    [TD="align: right"]-18000[/TD]

    [/tr]


    [tr]


    [td]

    VIP Industries

    [/td]


    [TD="align: right"]18000[/TD]

    [/tr]


    [/TABLE]


    Thanks for the help.

    Re: Extracting data from a grid on webpage


    Hi Pike,


    I could save the need to download the entire table if I could just click on a link on the page. Each invoice ID in the table is a clickable link but the link is created dynamically from a class.


    I am unable to attach any files from my office system but I will try and paste a snippet of the code which creates the fields in the columns. If only I could click those link, my job is done.

    Re: Extracting data from a grid on webpage


    Pike, This isindeed dumpingthe table to excel. I have one small concern though.


    There is an extra row above each row I . e.g i have 9 rows on the Web browser but the objTable count says 18 while debugging. Must be a backend thing. Can I just dump the rows based on a TR class ID. I have noticed that the 9 rows I need have a different class ID from that of the 9 rows i do not need.


    Also.... can I also just do a direct lookup from the code without having to dump the table.


    Thanks again.

    Re: Extracting data from a grid on webpage


    Thanks Pike. I will try this on Tuesday when I get back into my office network.


    This is where I stand now:
    1. I was able to modify your code in the other thread http://www.ozgrid.com/forum/showthread.php?t=187341 Post #3 and extract the table to excel (That includes the invoice id and invoice no. columns!!)
    2. I could do this because the table id for the table was unique (x:558988790.30:mkr:outerTbl.hdn in the code I pasted)
    3. There are however extra rows (one before each actual row) which contains some values I don't recognize. (the first cell in such rows is a concatenation of all values in the next actual row)
    4. I would love if I did not have to dump the data into excel and could just get the XXXXXX value from a given YYYYYY value. But I can work with table dump too (do a vlookup and delete the table data from excel)
    5. I looked into the code with the data of a few other invoices and it seems that the class id of the two columns remains constant as in the example. (Maybe this could be used to get the data, not sure)


    I will try and upload a bigger chunk of code on the thread on Monday if I can't get it to work with the code you gave me. Will have to do a lot of clean up of data before I do so or I will lose my job :)

    Re: Extracting data from a grid on webpage


    Thanks Pike for helping me out ... but I cannot understand much of the code from the link.


    But Let me try to explain.....
    I am pasting a piece of code here which I think forms the table and displays the first row. There were a lot of fields and formatting code which I have removed to keep the code short. In the code there is a value XXXXXX (Invoice number) which I want to obtain by providing the value YYYYYY (Invoice Id) which I have. I will then use this XXXXXX to create a link and then navigate forward.





    Would request you to have a look at advise if I can get the value I need by any method.

    I have an internal site which has a very complicated javascript code.


    I need to extract a value of InvoiceNo form a given InvoiceID. I will then use this InvoiceNo to conpose a URL to go to.


    It seems that there is a table/grid on the page. (The invoiceNo column is not shown, however i can see the corresponding values in the source code)


    The web code for this part is:

    Code
    1. var grid = $find("dgrdInfo");
    2. .
    3. .
    4. .
    5. .
    6. var str = grid._rows.get_row(eventArgs.get_item()._row._address).get_cellByColumnKey("INVOICE")._element.firstChild.nodeValue;
    7. window.open('CustomerCollections.aspx?ScreenType=invoicedetails&InvoiceNo=' + str + '&CustomerNo=' + custNumber, '_self');




    Note: I could either use the hyperlink on the Invoice Id column on the page. The table is created with a very complicated javascript code i cannot get to locate the link by looping through all hyperlinks on the page. (There are also no frame tags on the page)



    Request any folks here who have knowledge around this to help me.

    Re: Match positive and negative values withing subgroups


    Apologies Stephen, for not being clear. I just figured that this will work. Putting the formula in a new column marks the ones that need to be highlighted. Somehow, It is not working when I enter the formula in conditional formatting.


    However, I would love a VBA solution for two reasons:


    1. I have changed my code to highlight using different color each time. This will help because I am looking at a set of over 25,000 rows and many highlights will cause confusion.


    2. In the next step, I wish to offset several credits against a single debit. In the example, ABC -5000 would offset ABC 1000 and ABC 2000 both. Not bothered about the balance.

    Hi,


    I have a sheet which contains credits and debits for several accounts:


    [TABLE="class: cms_table"]

    [tr]


    [td]

    Customer

    [/td]


    [td]

    Amount

    [/td]


    [/tr]


    [tr]


    [td]

    ABC

    [/td]


    [td]

    2000

    [/td]


    [/tr]


    [tr]


    [td]

    XYZ

    [/td]


    [td]

    3000

    [/td]


    [/tr]


    [tr]


    [td]

    XYZ

    [/td]


    [td]

    1000

    [/td]


    [/tr]


    [tr]


    [td]

    ABC

    [/td]


    [td]

    1000

    [/td]


    [/tr]


    [tr]


    [td]

    ABC

    [/td]


    [td]

    -5000

    [/td]


    [/tr]


    [tr]


    [td]

    XYZ

    [/td]


    [td]

    1000

    [/td]


    [/tr]


    [/TABLE]



    What I need to do is match negative and positive values within each account and highlight them. I have been able to put together a VBA code from google and this forums to match within all rows.



    I need to adapt the code so as to do matching within accounts. Example within ABC and XYZ separately.There will be 100s of accounts.


    Please help!!