javascript searching and retrieving values




I am new to javascript goes without saying. I am developing a form in Adobe Experience Manager. My problem is I need to compare the date from a field in Table1 (Item.eff_date) to a field in a table called index (m_date) to get the value of a field (m_index_fuel) and place it in Table1 in the field monthly_index. The tables are both dynamic and have a field called num that is incremented by the script adjust.fuel_adjust.Table1._Item.addInstance(1);

m_index_fuel is always the first day of the month, m_date can be any date

What I am trying to accomplish is to compare to m_date and if it is new than m_index_fuel to go to the next line and start over. If the eff_date is older than the m_date, then I want to grab the value of m_index_fuel and place it in monthly_index and if I get to the end of the list, to show a message that the user needs to enter a current index for the month in question.

So far, my (very) rough script looks like this:

    var i = 1
    if( > date.toString(index.Item.m_date)){    i++;
    if(date.toString(Table1.Item.eff_date) <= date.toString(index.Item.m_date)){
    Table1.Item.monthly_index = index.Item.m_index_fuel;

Any help is appreciated and will be celebrated with a toast to you with my coffee cup.

Accepted Solutions (0)

Answers (0)