Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

javascript searching and retrieving values

Avatar

Avatar
Validate 1
Level 1
amerkfan
Level 1

Like

1 like

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
amerkfan
Level 1

Like

1 like

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
amerkfan
Level 1

14-09-2020

0

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 eff.date 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
    while(i<=index._Item.count😉
    if(date.to(String(Table1.Item.eff_date) > 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)