Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically sort XML spreadsheet on open?

Status
Not open for further replies.

rss0213

Programmer
Jul 12, 2007
58
US
I have an XML Spreadsheet that I'm creating on the mainframe and sending to my users. I would like for the data in the rows (which I'm creating on the fly with a COBOL program on the MF) to be sorted when the user opens the XML attachment (which opens in Excel). I have the following tags in the XML:

Code:
  <Sorting xmlns="urn:schemas-microsoft-com:office:excel">
   <Sort>Delivery Method</Sort>
   <Sort>Customer Name</Sort>
  </Sorting>

Delivery Method is column 2, Customer Name is column 1.

So when I select the data range and click 'Data', 'Sort...', it defaults to this sort sequence, but I would like for it to sort the data when the spreadsheet is opened instead of the user having to do this. Is there a way to "force" this sort operation to happen when the attachment is opened?

Thanks!
Scott
 
Well, I actually considered sorting the row data on the mainframe prior to creating the XML, but the COBOL program that I'm modifying to create the XML file was written long ago by a programmer that didn't use good coding technique, so I'd basically have to re-write the program (it's "spaghetti" code, i.e. lots of "GO TO" statements and no "PERFORM" statements). I also could have made the COBOL program just write the row data to a file (without the XML tags), added a step after the COBOL program in the JCL to sort the row data, then had another program to build the XML tags around the data, but that was just a lot more work.

If it can't be sorted automatically, the users can just perform a few clicks to get it sorted - it's no big deal. I was just looking for a way to automate the sort.

Thanks!
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top