Printing month of year from date field as label of enum val.

hkrisz79
Member Posts: 13
Hi there,
I have a problem with a report where I want to print out the name of the month comes from a date field.
I made a display method:
display MonthsOfYear dispMonthOfDate()
{
return mthofyr(custConfirmJour.ConfirmDate);
}
Ok, It's works fine. But, I want to set the printed text to lowercase.
To make clear: It's prints : "May" , and I want to print out: "may"
I switched on the AutoDeclaration for the affected field in the report, and
put in the fetch the
dispMonthOfDate.changeCase(...);
, but it isn't works.
Could somebody help me?
Thanks in advance!
I have a problem with a report where I want to print out the name of the month comes from a date field.
I made a display method:
display MonthsOfYear dispMonthOfDate()
{
return mthofyr(custConfirmJour.ConfirmDate);
}
Ok, It's works fine. But, I want to set the printed text to lowercase.
To make clear: It's prints : "May" , and I want to print out: "may"
I switched on the AutoDeclaration for the affected field in the report, and
put in the fetch the
dispMonthOfDate.changeCase(...);
, but it isn't works.
Could somebody help me?
Thanks in advance!
Best Regards
Krisztian Hampuk
AX Consultant
Krisztian Hampuk
AX Consultant
0
Comments
-
Hello hkrisz
Why not just use strlwr() function in your display:
display MonthsOfYear dispMonthOfDate()
{
return strlwr(mthofyr(custConfirmJour.ConfirmDate));
}
As for your question:
I guess that after executing 'fetch' the method 'dispMonthOfYear' is called again to fill that reportfield.
Put a breakpoint on fetch and on dispMonthOfDate and see in what sequence the code is done...Bert van Dijk
Rotor BV0 -
burdee64 wrote:Hello hkrisz
Why not just use strlwr() function in your display:
display MonthsOfYear dispMonthOfDate()
{
return strlwr(mthofyr(custConfirmJour.ConfirmDate));
}
As for your question:
I guess that after executing 'fetch' the method 'dispMonthOfYear' is called again to fill that reportfield.
Put a breakpoint on fetch and on dispMonthOfDate and see in what sequence the code is done...
Hello burdee,
I'm afraid of you didn't understand the point of this issue.
Type of the out put of mthofyr() is INT.
Do you want to convert to lowercase an INT ?
I don't think so...
An other thing:
The return type of my dispMonthOfDate() method is ENUM.
The MonthsOfYear is a standard enum what contain the months and every
enum value has a label.
The good news:
In the mean time I solved this problem with a simple SWITCH - CASE.
Here it is:
display str dispMonthOfDate()
{
int month;
str monthTxt;
;
month = mthofyr(custQuotationJour.QuotationDate);
switch(month)
{
case 1 : monthTxt = label.extractString(literalStr("@SYS24776");
break;
case 2 : monthTxt = label.extractString(literalStr("@SYS24777");
break;
case 3 : monthTxt = label.extractString(literalStr("@SYS24778");
break;
case 4 : monthTxt = label.extractString(literalStr("@SYS24779");
break;
case 5 : monthTxt = label.extractString(literalStr("@SYS24780");
break;
case 6 : monthTxt = label.extractString(literalStr("@SYS24781");
break;
case 7 : monthTxt = label.extractString(literalStr("@SYS24782");
break;
case 8 : monthTxt = label.extractString(literalStr("@SYS24783");
break;
case 9 : monthTxt = label.extractString(literalStr("@SYS24784");
break;
case 10 : monthTxt = label.extractString(literalStr("@SYS24785");
break;
case 11 : monthTxt = label.extractString(literalStr("@SYS24786");
break;
case 12 : monthTxt = label.extractString(literalStr("@SYS24787");
break;
default : break;
}
if(custQuotationJour.LanguageId == CompanyInfo::find().LanguageId)
{
return strlwr(monthTxt);
}
else
{
return monthTxt;
}
}Best Regards
Krisztian Hampuk
AX Consultant0 -
Hi hkrisz79,
U can use a simple method mthname(), which returns the month name.
For eg, a job code:
static void monthName(Args _args)
{
str month;
date _date;
;
_date = systemDateget();
month = strlwr(mthname(mthofYr(_date)));
print month;
pause;
}
I hope that will solve ur problem... \:D/0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions