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 793
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:
  • Waed Ayyad Profile Picture
    7,897 Super User 2025 Season 1 on at
    map whee key is of type time

    Hi, 

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

    Thanks,

    Waed Ayyad

  • Waed Ayyad Profile Picture
    7,897 Super User 2025 Season 1 on at
    map whee key is of type time

    Hi, 

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

    Thanks,

    Waed Ayyad

  • Waed Ayyad Profile Picture
    7,897 Super User 2025 Season 1 on at
    map whee key is of type time

    Hi, 

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

    Thanks,

    Waed Ayyad

  • Layan Jwei Profile Picture
    7,725 Super User 2025 Season 1 on at
    map whee key is of type time
    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
    7,897 Super User 2025 Season 1 on at
    map whee key is of type time

    Hi, 

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

    Thanks,

    Waed Ayyad

  • Martin Dráb Profile Picture
    231,925 Most Valuable Professional on at
    map whee key is of type time
    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
    7,897 Super User 2025 Season 1 on at
    map whee key is of type time
    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
  • dark_knight Profile Picture
    793 on at
    map whee key is of type time
    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
  • Suggested answer
    Waed Ayyad Profile Picture
    7,897 Super User 2025 Season 1 on at
    map whee key is of type time
    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

     

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,245 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,925 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans