Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

Friday, September 12, 2014

Searching Excel with iLogic II: Header Rows

A few blogs back, my partner in crime Carl Smith posted about searching Excel with iLogic as a means of gathering data for ever changing projects.  This has come in handy multiple times for me.


I recently had a case where a client had a very nice looking Excel file with data at the top.  This forced the column headers I was searching for down a few rows.  An example is shown to the right.

By default, the GoExcel.FindRow likes the Column that is searching for to be in Row 1 of the worksheet.

This can be changed by using GoExcel.TitleRow.  This will allow you to tell iLogic what row to start looking for column names.

Before your GoExcel.FindRow command, add:

GoExcel.TitleRow = X

Replace the X with the row your Column headings are located in.

Here is what the code section would look like:

GoExcel.TitleRow = 8
i = GoExcel.FindRow("SalesOrders.xlsx", "Header", "Part Number", "=", PartNumber)

Description = GoExcel.CurrentRowValue("Description")
Length = GoExcel.CurrentRowValue("Length")

Randy


"I have not failed. I've just found 10,000 ways that won't work.~Thomas A. Edison


Monday, January 9, 2012

Searching Excel with iLogic


This is an interesting iLogic solution to a problem where part inventories may dictate the values of a component in an assembly.
Perhaps the inventory changes somehow on a regular enough basis and modifying the actual code would not be practical; or the person who determines the value of that database is not an Inventor user.

This particular client had an ever expanding list of customers with varying requirements for the end product including machining tolerances, available fastener specifications and approved material lists to name a few.

As new customers were added it seemed to be a constant struggle to add the new values into the iLogic code and, believe it or not, sometimes the existing customers would change their mind - almost NEVER happens right? ;-)