After researching the Google-verse on this topic and reading about 20 to 30 non-conforming, non-agreeing, completely different examples (and certainly trying a few of them in Epicor’s custom script editor), I seem to be more confused about this than I was when I previously started.
Let’s say I have only two records in “UD11”.
My requirement is to sort the data view by “ShortChar01” in descending order and return only a specific value within the first row of data in that view. I’ve read where the data view does not accept any parameters related to “row” or “rows” - and that the view would need to be converted to a data table first (of course, no examples of how this is accomplished and further research on that generated even more confusion for me). Anyway, here’s what seemed to make sense for me to do (see below), but the “strPartNum” value contains no data.
I create a new data view, then define it as a view for “UD11”, then sort the view by the “ShortChar01” field in descending order.
Now, my understanding is, in order to return values from a specific row, I’d have to pass the row index on the data view. Since I’m not doing that, any row reference will be applied on the first, or current row in the data view. Since I’ve sorted the view prior to retrieving data on the first/current row, I should be getting a value from the “top 1 of all [ShortChar01] fields”. My expectation here is that I should be returning a value of “100-570-1010” from the sorted rows on the “ShortChar01” column. Yet, nothing gets populated in the “strPartNum” container.
Since nothing is being returned, I’m obviously missing something, or using the wrong method for this. Might someone point me to a reference that might provide me with a better understanding of the EpiDataView object, how to properly define it, navigate through it, and how to return values from it? Also, is there a Epicor best-practice for referencing the EpiDataView (I ask merely because it seems to be a wild frontier out there with the numerous differing examples)?
Thank you for assisting.