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 :
Microsoft Dynamics AX (Archived)

View Date Computed Column

(0) ShareShare
ReportReport
Posted on by 2,426

Good Morning,

I am using one view

for that i have Added Query and to that Query i added datasource PurchAgreementHeader and Fields - Yes

Now when i drag that Query to new View

I am Unable to get CreatedDateTime .

So i have Written Computed Column to Return CreatedDatetime 

and Added one DateComputedColumn Field for View and i am able to see data now for that Date Computed Column.

But now the problem is  i need it to return as date.as of now it is returning UTC Date time format.

How can i get Date For Created Date Time in View Method.

my method is a s follows.

public server static str AgreementStartDate()
{
SysDictTable purchagreementheader = new SysDictTable(tableNum(PurchAgreementHeader));
DictView dv = new DictView(tableNum(PurchaseCommissionReportView));
str createddatetime;
createddatetime = strFmt('SELECT TOP 1 (%1) FROM %2 WHERE %2.%3 = %4',
purchagreementheader.fieldName(fieldNum(PurchAgreementHeader,CreatedDateTime),DbBackend::Sql),
purchagreementheader.name(DbBackend::Sql),
purchagreementheader.fieldName(fieldNum(PurchAgreementHeader,PurchNumberSequence),DbBackend::Sql),
dv.computedColumnString(tableStr(PurchAgreementHeader),fieldStr(PurchAgreementHeader,PurchNumberSequence),FieldNameGenerationMode::WhereClause));
return createddatetime;
}

I have PurchNumberSequence(Agreementid).and then i am Returning its CreatedDAteTime.

It is coming .But i need in Date.

Please show some light.

Regards.

Have a great day.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Are you saying that you've got a wrong type of computed column (UtcDateTime instead of Date), or that you get the date in UTC time zone instead of converted to the local time zone?

  • AX 2012 r3 Profile Picture
    2,426 on at

    1. I created one view method

    2.Returning Created Date time.

    3.Created one field i.e Utc Date Column and Using this View Method for theUtc Field in View.

    4.I want Only Date from Utc Date time.

  • AX 2012 r3 Profile Picture
    2,426 on at

    it is coming for now.

    What i have done is .

    I am returning String Value.

    and i have added Only Date Colum Field then i used that View method

    and now i am getting only Date for UTC DAte Time.

  • AX 2012 r3 Profile Picture
    2,426 on at

    But Some Times i am Facing SQL Error.

    How can we do this.

    Please show some light on this.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I still don't know if you want UtcDateTime type or Date; you mentioned both.

    If your intention is keep using UtcDateTime but hiding the time part, use an EDT and change properties like Time Hours to No.

    String would be very wrong format for dates; don't do it.

    If you need some help with the SQL error, you'll have tell us what error it is.

  • AX 2012 r3 Profile Picture
    2,426 on at

    I added Date Column Field to view and added String Returning Method.

    How View is showing date(Date Column Value) for string Returning Value.

    Please elaborate

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi Sukrut.

    I have mentioned complete info.I think you havent read my post completely.

    Again i am Statring from Top.

    1.i need CreatedDate time from Purchase Agreement Header Table.

    2.Already i designed one query and in that i have given Datasource where i have PurchTable.

    So,in purchtable there is MatchingAgreement.

    3.With That Matching Agreement i have Written View Method To Get Created Date Time for That particular MatchingAgreement.

    4.Now  i need to show on date for that CreatedDatetime.

    Now i think it is clear .

    Regards.

  • Verified answer
    AX 2012 r3 Profile Picture
    2,426 on at

    I have done.No error is coming.

    1.I am returning UtcDate Time in String Method

    2.Created Date Column and in that View method i gave this (1 Step) Method

    3.It is working fine .

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans