AnsweredAssumed Answered

Comparing data from two records

Question asked by tony24601 on Jun 16, 2010
Latest reply on Jun 16, 2010 by tony24601


Comparing data from two records


Hi, I was wondering if something like this is possible, since I couldn't seem to find a way to do it. I have a list of line items from a purchase report, and each of those items is associated with a particular order number. Each item being purchased needs to be categorized, and the user can select a category from a list. The thing is, I want the category to autocomplete as the user enters in the purchased line items so that, once they select a category for one item in the list the next item will have the same category (and they can change it if need be). So basically, the code I want does this:

autofill by calculation:

if the purchase number for new line item is the same as the purchase number for the last line item

    current line item gets the same category as the previouse line item

otherwise do nothing (since it means its the first item being listed in this order)


or in a slightly code-ier way:

if(newLineItem.purchaseID == previousLineItem.purchaseID)

     newLineItem.category = oldLineItem.category;


My problem is that I don't know any way to get the purchaseID value (or category value, or any other value) so that I can compare it to the new item's value. Any ideas? (sorry if that was wordy).