Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Suggested answer

Page 99000889 (machine center load) - Odata URL - how to set PeriodType property to 'week'

Posted on by 25

Hello Nav Experts,

I contact you because I m facing a little problem building an Odata URL.

I have published the page 99000889 wich displays the load for a particular machine center.

The name of my Web Service for this page is Charge_CDC and I have a machine center called CHAU100

So, If I run the Odata URL : localhost:7048/.../Charge_CDC(No='CHAU100') I get a result.

Nevertheless, the result I get is in days (the default) and I would like to have it agregated by weeks (Like i can do into the nav interface).

For that, there s a property called PeriodType

So, I have tried : localhost:7048/.../Charge_CDC(No='CHAU100' ,PeriodType='week')  without success.

When I run it, I get an error mesage saying the the syntax is incorrect.

Does someone know how I should build my URL to get the result in weeks ?

Thanks a lot for the time you took to read my post and for you help in advance :-)

Regards,

Jérôme

Categories:
  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Page 99000889 (machine center load) - Odata URL - how to set PeriodType property to 'week'

    Hello Jérôme - I would recommend creating a support ticket for Microsoft to investigate.

  • SEMAT Profile Picture
    SEMAT 25 on at
    RE: Page 99000889 (machine center load) - Odata URL - how to set PeriodType property to 'week'

    Hello Andy,

    Thanks a lot for your reply.

    For me, with the Cronus database it does noit work.

    When run the URL localhost:7048/.../Charge_CDC(No='CHAU100')

    I get the following result :

    <entry xml:base="localhost:7048/.../">

    <id>localhost:7048/.../id>

    <title type="text"/>

    <updated>2020-11-06T20:18:18Z</updated>

    <author>

    <name/>

    </author>

    <link rel="edit" title="Charge_CDC" href="Charge_CDC('CHAU100')"/>

    <link rel="schemas.microsoft.com/.../Charge_CDCMachineCLoadLines" type="application/atom+xml;type=feed" title="Charge_CDCMachineCLoadLines" href="Charge_CDC('CHAU100')/Charge_CDCMachineCLoadLines"/>

    <category term="NAV.Charge_CDC" scheme="schemas.microsoft.com/.../>

    <content type="application/xml">

    <m:properties>

    <d:No>CHAU100</d:No>

    <d:PeriodType>Day</d:PeriodType>

    <d:AmountType>Net Change</d:AmountType>

    </m:properties>

    </content>

    </entry>

    When I run the URL : localhost:7048/.../Charge_CDC eq 'CHAU100' and PeriodType = 'Week'

    I get :

    <feed xml:base="localhost:7048/.../">

    <title type="text">Charge_CDC</title>

    <id>localhost:7048/.../id>

    <updated>2020-11-06T20:23:33Z</updated>

    <link rel="self" title="Charge_CDC" href="Charge_CDC"/>

    <entry>

    <id>localhost:7048/.../id>

    <title type="text"/>

    <updated>2020-11-06T20:23:33Z</updated>

    <author>

    <name/>

    </author>

    <link rel="edit" title="Charge_CDC" href="Charge_CDC('110')"/>

    <link rel="schemas.microsoft.com/.../Charge_CDCMachineCLoadLines" type="application/atom+xml;type=feed" title="Charge_CDCMachineCLoadLines" href="Charge_CDC('110')/Charge_CDCMachineCLoadLines"/>

    <category term="NAV.Charge_CDC" scheme="schemas.microsoft.com/.../>

    <content type="application/xml">

    <m:properties>

    <d:No>110</d:No>

    <d:PeriodType>Day</d:PeriodType>

    <d:AmountType>Net Change</d:AmountType>

    </m:properties>

    </content>

    </entry>

    <entry>

    Which is result for all the machine center I have. So the filter on the machine center No seems not to be applied and the PeriodType is still set to 'Day'.

    Another problem I will face later is that, I will also run in the url : Charge_CDCMachineCLoadLines because it is the subpage which gives the final result.

    When I run the URL :

    ..../Charge_CDC(No='CHAU100')/Charge_CDCMachineCLoadLines

    I get the correct result but the PeriodType is 'Day' :-(  :

    <feed xml:base="localhost:7048/.../">

    <title type="text">Charge_CDCMachineCLoadLines</title>

    <id>localhost:7048/.../id>

    <updated>2020-11-06T20:27:07Z</updated>

    <link rel="self" title="Charge_CDCMachineCLoadLines" href="Charge_CDCMachineCLoadLines"/>

    <entry>

    <id>localhost:7048/.../id>

    <title type="text"/>

    <updated>2020-11-06T20:27:07Z</updated>

    <author>

    <name/>

    </author>

    <link rel="edit" title="Charge_CDCMachineCLoadLines" href="Charge_CDCMachineCLoadLines(Period_Start=datetime'2020-11-06T00%3A00%3A00',Period_Type='Date')"/>

    <category term="NAV.Charge_CDCMachineCLoadLines" scheme="schemas.microsoft.com/.../>

    <content type="application/xml">

    <m:properties>

    <d:Period_Type>Date</d:Period_Type>

    <d:Period_Start m:type="Edm.DateTime">2020-11-06T00:00:00</d:Period_Start>

    <d:Period_Name>Friday</d:Period_Name>

    <d:MachineCenter_Capacity_Effective m:type="Edm.Decimal">0</d:MachineCenter_Capacity_Effective>

    <d:AllocatedQty m:type="Edm.Decimal">0</d:AllocatedQty>

    <d:CapacityAvailable m:type="Edm.Decimal">0</d:CapacityAvailable>

    <d:CapacityEfficiency m:type="Edm.Decimal">0</d:CapacityEfficiency>

    </m:properties>

    </content>

    </entry>

    <entry>

    <id>localhost:7048/.../id>

    <title type="text"/>

    <updated>2020-11-06T20:27:07Z</updated>

    <author>

    <name/>

    </author>

    <link rel="edit" title="Charge_CDCMachineCLoadLines" href="Charge_CDCMachineCLoadLines(Period_Start=datetime'2020-11-07T00%3A00%3A00',Period_Type='Date')"/>

    <category term="NAV.Charge_CDCMachineCLoadLines" scheme="schemas.microsoft.com/.../>

    <content type="application/xml">

    <m:properties>

    <d:Period_Type>Date</d:Period_Type>

    <d:Period_Start m:type="Edm.DateTime">2020-11-07T00:00:00</d:Period_Start>

    <d:Period_Name>Saturday</d:Period_Name>

    <d:MachineCenter_Capacity_Effective m:type="Edm.Decimal">0</d:MachineCenter_Capacity_Effective>

    <d:AllocatedQty m:type="Edm.Decimal">0</d:AllocatedQty>

    <d:CapacityAvailable m:type="Edm.Decimal">0</d:CapacityAvailable>

    <d:CapacityEfficiency m:type="Edm.Decimal">0</d:CapacityEfficiency>

    </m:properties>

    </content>

    </entry> etc .....

    If you have any more idea... I have tried all possible combinations without success :-(

    Thanks a lot for your help and patience,

    Regards,

    Jérôme

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Page 99000889 (machine center load) - Odata URL - how to set PeriodType property to 'week'

    I tested on my Odata webservice in Postman and I get it to work with filters.  Can you try this:

    Charge_CDC?$filter=No eq 'CHAU100' and PeriodType eq 'Week'

  • SEMAT Profile Picture
    SEMAT 25 on at
    RE: Page 99000889 (machine center load) - Odata URL - how to set PeriodType property to 'week'

    Hello Andy,

    Thanks a lot for your answer.

    Nevertheless I get the same error  n°  (400)

    Do you have another idea :-) ?

    Best Regards,

    Jérôme

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Page 99000889 (machine center load) - Odata URL - how to set PeriodType property to 'week'

     Hello Jérôme - When I inspect the page 99000889 it shows the field as Period Type not PeriodType.  Maybe add a space?

    localhost:7048/.../Charge_CDC(No='CHAU100' ,Period Type='week')  

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans