web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

map whee key is of type time

(6) ShareShare
ReportReport
Posted on by 942
Hello,
 
I need such map 
 
Map    loadingWindows = new Map(Types::Time, Types::String);
 
to be filled in like that
 
while select salesShipLoadingWindows
        order by BeginTime
        where salesShipLoadingWindows.BeginTime >= begginigTime
    {
        loadingWindows.insert(salesShipLoadingWindows.BeginTime, salesShipLoadingWindows.LoadingWindowId);
    }
 
key isn't filled up at all and it's stuck on the first pair of key-value. So this is because key value is of type TIME as I see. does it mean map doesn't work with such type of the key?
 
Thanks.
Categories:
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    Did you check salesShipLoadingWindows.BeginTime field, do all records have the same time? if yes, then only one record will be saved.
     
    Check the below example:

    public static void main(Args _args)

      {

          Map map = new Map (Types::Integer, Types::String);

          // inserting key and values

          map.insert (1,"A");

          map.insert (1,"B");

          map.insert (3,"C");

          map.insert (4,"D");

          map.insert (5,"F");

     

          if (! map.empty ())

          {

              Info(map.lookup(1)); // It will return B

          }

      }


    Thanks,

    Waed Ayyad

    If this helped, please mark it as "Verified" for others facing the same issue

     
  • dark_knight Profile Picture
    942 on at
    I have 8 records in salesShipLoadingWindows and all of them have different value BeginTime. the thing is time value isn't saved to the key at all. that's strange
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Can you share the result of the map "t's stuck on the first pair of key-value"? Also, can you share the field value in the 8 records?
     
    What is the EDT of BeginTime?
     
    Thanks,
    Waed Ayyad
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    Let's try a test case that doesn't depend on unknown data in database and it includes a way of checking the map content:
    Map map = new Map(Types::Time, Types::String);
    
    map.insert(1*60, "x");
    map.insert(2*60, "y");
    
    MapEnumerator enumerator = map.getEnumerator();
    
    while (enumerator.moveNext())
    {
        info(strFmt("%1: %2", enumerator.currentKey(), enumerator.currentValue()));
    }
    The result looks correct to me:
     
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at

    Hi, 

    Is your issue resolved? If yes, mark the answers that helped you as verified. 

    Thanks,

    Waed Ayyad

  • Layan Jwei Profile Picture
    8,118 Super User 2025 Season 2 on at
    Hi,
     
    What do you mean it's stuck on the first pair? Does it enter the while loop when you debug?
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at

    Hi, 

    Is your issue resolved? If yes, mark the answers that helped you as verified. 

    Thanks,

    Waed Ayyad

  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at

    Hi, 

    Is your issue resolved? If yes, mark the answers that helped you as verified. 

    Thanks,

    Waed Ayyad

  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at

    Hi, 

    Is your issue resolved? If yes, mark the answers that helped you as verified. 

    Thanks,

    Waed Ayyad

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans