Hi,
I have made a solution for the problem. You need to extract
the labels from the enums in the AOT.
Goes something like this:
public void run()
{
EDAViewWizardEnum viewWizardEnumTable;
EDAViewWizardLanguage viewWizardLanguageTable;
Dictionary dictionary;
DictEnum dictEnum;
EnumId enumId;
xInfo xInfo;
int i, idx;
RunBaseProgress progress;
LanguageId currentLanguageId;
;
Dictionary = new Dictionary();
xInfo = new xInfo();
select count(RecId) from viewWizardLanguageTable;
progress = new RunBaseProgress(2);
progress.setCaption(" EDA23");
progress.setAnimation(#AviUpdate);
progress.setTotal(viewWizardLanguageTable.RecId,
#second);
progress.setTotal(dictionary.enumCnt(), #first);
progress.setText(" SYS4195", #first);
delete_from viewWizardEnumTable;
startLengthyOperation();
while select viewWizardLanguageTable
{
Progress.setText(viewWizardLanguageTable.LanguageId,
#second);
currentLanguageId = xInfo.language();
xInfo.language(viewWizardLanguageTable.LanguageId);
for (i = 1; i <= dictionary.enumCnt(); i++)
{
enumId = dictionary.enumCnt2Id(i);
dictEnum = new DictEnum(enumId);
if(dictEnum)
{
Progress.setText(dictEnum.name(), #first);
idx = 0;
for (idx = 0; idx < dictEnum.values();
idx++)
{
viewWizardEnumTable.LanguageId =
viewWizardLanguageTable.LanguageId;
viewWizardEnumTable.BaseEnumId =
enumId;
viewWizardEnumTable.BaseEnumName =
dictEnum.name();
viewWizardEnumTable.BaseEnumLabel =
dictEnum.label();
viewWizardEnumTable.BaseEnumValueName =
dictEnum.index2Symbol(idx);
viewWizardEnumTable.BaseEnumValueLabel =
dictEnum.index2Label(idx);
viewWizardEnumTable.BaseEnumValue =
dictEnum.index2Value(idx);
viewWizardEnumTable.insert();
}
}
Progress.incCount(1, #first);
}
Progress.incCount(1, #second);
}
xInfo.language(currentLanguageId);
EndLengthyOperation();
}
Then you need to make a table also from within Ax storing
the fields that uses Enums and the Enum Id it uses. (As I
create a view from within AX I did not need this table). You
need to loop over the data dictionary (SysDictionary,
sysDictTable, SysDictField). Here you will find the Property
Enum and SQLName, remember the tableName (DBBackend).
Now You can Join the Enumvalue with this table:
Select custAccount, Name from CustTable
LEFT OUTER JOIN BaseEnumValueLabel from
viewWizardEnumTable
Where languageId = 'en-us'
And BASEENUMID = 53 (CustVendBlocked) <ID of the
enum the field uses>
And BASEENUMVALUE = CustTable.Blocked
Mit freundlichen Grüßen / Best regards / Med venlig hilsen
Jesper Jørgensen / Abt. NMT-XD
Senior Product Manager
arvato systems | Technologies GmbH
An der Autobahn 18
33311 Gütersloh
jesper.joergensen bertelsmann.de
Phone: +49 5242 / 40 80 54
Fax: +49 5242 / 40 80 40
Mobile: +49 172 / 571 03 34
http://www.as-T.biz
arvato systems | Technologies GmbH
Joachim-Jungius-Str. 9, 18059 Rostock
Geschäftsführung: Erwin Pietz, Matthias Moeller
Amtsgericht Rostock - HRB 7497
________________________________
"Der Inhalt dieser Nachricht oder eventueller Anlagen
ist vertraulich und ausschließlich für den bezeichneten
Adressaten bestimmt. Bitte stellen Sie sicher, dass die
Information in dieser Nachricht ausschließlich an die
adressierten Personen gelangt. Sollte diese Nachricht
versehentlich an Sie gesendet worden sein, dann informieren
Sie bitte umgehend den Absender und löschen Sie die
Nachricht. Vielen Dank."
"The information in this e-mail and any attachments is
confidential. The information must only be held in areas
that have controlled and limited access to the addressed
persons. If this e-mail has been sent to you in error,
please immediately notify the sender and delete the e-mail.
Thanks."
________________________________
-----Ursprüngliche Nachricht-----
Von: development-axapta@yahoogroups.com
[mailto:development-axapta@yahoogroups.com] Im Auftrag von
Ozanhan Anaç
Gesendet: Mittwoch, 12. März 2008 15:47
An: development-axapta@yahoogroups.com
Betreff: RE: [development-axapta] Enum values in SQL
database
Hi Anýl,
As enum types stored in the application (not in SQL), there
shouldn't be a
flexible way to show that values.
Instead, you can use HARDCODED switch cases in your views.
For example :
Create view vw_blabla
As
Select StatusIssue_Text = case StatusIssue when 0 then
'none' when 1 then
'sold' ....., StatusIssue, ...,.... from bmssa.INVENTTRANS
Regards,
Ozan
_____
From: development-axapta@yahoogroups.com
[mailto:development-axapta@yahoogroups.com] On Behalf Of
Anil Ozay
Sent: Wednesday, March 12, 2008 2:45 PM
To: Axapta-Knowledge-Village@yahoogroups.com;
development-axapta@yahoogroups.com
Subject: [development-axapta] Enum values in SQL database
Hi,
We want to create a view on SQL server for InventTrans and
tha table has
enum values.
SQL uses integer values to store enum values but we want to
show enum values
to user.
Is it possible to find the enum values on database to show
in the view?
Regards,
Anil Ozay
[Non-text portions of this message have been removed]
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.518 / Virus Database: 269.21.6/1318 - Release
Date: 07.03.2008
14:01
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.518 / Virus Database: 269.21.6/1318 - Release
Date: 07.03.2008
14:01
No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.518 / Virus Database: 269.21.6/1318 - Release
Date: 07.03.2008
14:01
[Non-text portions of this message have been removed]
Yahoo! Groups Links
htt
p://groups.yahoo.com/group/development-axapta/
Individual Email | Traditional
http://groups.yahoo.com/group/development-axapta/join
(Yahoo! ID required)
mailto:development-axapta-digest@yahoogroups.com
mailto:development-axapta-fullfeatured@yahoogroups.com
development-axapta-unsubscribe@yahoogroups.com
http://docs.yahoo.c
om/info/terms/
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
htt
p://groups.yahoo.com/group/development-axapta/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/development-axapta/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:development-axapta-digest@yahoogroups.com
mailto:development-axapta-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
development-axapta-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|