Hello (and Happy New Year),
We have a simple function that iterates over the rows of a datawidnow and fill some objects from some of the items in the row. This function looks like the following:
public subroutine fill_recipe_components(datawindow a_dw)
long ll_index, ll_tot
ll_tot = a_dw.rowCount()
for ll_index = 1 to ll_tot
st_recipe_component lst_recipe_component
lst_recipe_component.s_code = a_dw.GetItemString(ll_index, 'article_code_article')
lst_recipe_component.d_percentage = a_dw.GetItemNumber(ll_index, 'pourcentage')
ist_recipe_component[ll_index] = lst_recipe_component
next
end subroutine
We have another function that does exactly the same thing, but on a datastore:
public subroutine fill_recipe_components(datastore a_dw)
long ll_index, ll_tot
ll_tot = a_dw.rowCount()
for ll_index = 1 to ll_tot
st_recipe_component lst_recipe_component
lst_recipe_component.s_code = a_dw.GetItemString(ll_index, 'article_code_article')
lst_recipe_component.d_percentage = a_dw.GetItemNumber(ll_index, 'pourcentage')
ist_recipe_component[ll_index] = lst_recipe_component
next
end subroutine
As one may notice, those functions are strictly identical (to the point we misnamed the datastore parameter a_dw). Is there a way to have a single function instead of 2? It seems like datastore and datawindow are related and have at least a subset of their methods as common interfaces, but the compiler rejects passing one when the other is expected. We tried wrapping a datawindow in a datastore by assigning the dw to the object property of a (new) datastore but this does not work.