i am new to ax2012. I have a doubt in asset depreciation profile form.There is combo box called period frequency in that, i need to add a field called monthly. Can any one help me out ?
I have tried out by creating base enum for monthly filed but i didn't get the output required.
This field is an Enum of type AssetAccrualFiscal, therefore you need to add a monthly element to this AssetAccrualFiscal in the AOT.
Beware however, the field is controlled by an edit method, and changing the field triggers some business logic.
This can be found in the table method accrualFiscal() on the table AssetDepreciationProfile. You may need to decide which part of the existing logic needs to consider your new enum element when it is selected.
See my comment, but basically you need to find out which base enum the combo box uses (supposing it is an enum combo box) and add a new element "monthly" to that enum.
If it is a standard enum, please leave a gap between the last enum element index and the index of your new element. This leaves room for new elements from Microsoft and enables easier upgrades.
Did some digging, in AX 2012 R2 there already is an element "monthly" for the period frequency combo box. Please take a look at enum "AssetAccrualCalendar" and method "accrualCalendar" on table AssetDepreciationProfile.
Related
Grid Pro features three recommended built-in editors: Text Field, Checkbox, and Select.
Ho can you manage a list with key and value properties?
For example:
Country list
I'm unable to show country name in the select value and save the id in the database record.
I usually rely on ComboBox when I manage a list with key and value.
Combobox is not present in the list of built-in editors.
Do you suggest to write your own editor?
Let's assume you have a Country class with the properties id and name. And a Person class with a country property. You display a GridPro<Person>.
You can make a Select editor and define it's itemLabelGenerator (or renderer, if you want to show a flag or something) to show Country::getName. **
The saving to the database should be handled by the annotations on the relation. Usually using JPA, there would be a #ManyToOne relation between Person and Country, and save the country-FK (id, specified using #Id) in the person table.
** I don't use Grid Pro, but upon inspection of the code I can see that by using gridPro.addEditColumn(Person::getCountry).select(Person::setCountry, countriesList) you cannot specify the itemLabelGenerator/renderer.
However, you could prepare your own Select component and use the EditColumnConfigurator::custommethod.
Select<Country> countryEditorComponent = new Select<>();
countryEditorComponent.setItems(countriesList);
countryEditorComponent.setItemLabelGenerator(country -> country.getName());
gridPro.addEditColumn(Person::getCountry).custom(countryEditorComponent , Person::setCountry).setHeader("Country");
In App Maker, what is the simplest way to achieve the same result with a dropdown box that you can with a suggest box, which can return the whole record when you make a selection giving you the ability to assign associated record values to other fields on the page?
Consider a data model with three fields, (Code, Description, and Severity). Add a dropdown box to select the Code. Have the selection, (probably using onValueChange or onValueEdit), write the selected Code's Description to a label field beside the dropdown box. The Code's Severity will also be used to affect the style in some way like background color or something, but for this answer, merely assigning the value to a scripting variable will be good enough. It's the record value access and assignment mechanism I am after.
Clarification: This data model will not be the page's datasource. It is a secondary reference table used for assigning a code to a ticket. You can also assume that a record value will be written to a field in the page's datasource as well.
I would appreciate the simplest low code solution as we will have non-programmers attempting this. Thanks.
As long as you leave your value binding on the dropdown blank the following should work:
Set the options binding to:
#datasources.YourDatasource.items
You may want to consider changing the 'Names' binding to be the projection of a particular field in this datasource otherwise the values showing in your dropdown will only be the 'keys' from this datasource.
Then in your onValueEdit event you will gain access to individual fields like this:
var item = widget.datasource.item;
item.YourFieldToEdit1 = newValue.YourOtherDatasourceField1;
item.YourFieldToEdit2 = newValue.YourOtherDatasourceField2;
That would probably be the simplest way.
I am trying to implement a Many-to-Many relation between a class and its students in a form.
The form can be used to create or edit a class. Also students can be added to that class. To reduce the effort needed to enter students, I would like to add a multi-select that shows the entries from the students-table. But since the number of students is expected to be large, I would like to filter this multi-select.
I checked this question on filtering lists and the sample app "Project List. I understand that the standard workflow with a table would be to bind the value of a search box to the #datasources.STUDENTS.query.filters.email._contains and set the tables datasource property to STUDENTS
But, as I understand it, a multi-select element's value property must be bound to #datasource.item.students and its datasource property must be CLASS in order for the auto-saving to work.
Hence I wonder whether it is possible to filter a multi-select element.
I don't see the problem, but I think I see a misunderstanding.
You said: "I understand that the standard workflow with a table would be to bind the value of a search box to the #datasources.STUDENTS.query.filters.email._contains"
You need to bind the OPTIONS (not value) to the datasource query, as it is the options that will draw its records from the #datasources.Students.query datasource.
You can then set the VALUE of the multi-select widget to #datasource.item.students (where you want selected values from the student query options to be saved).
You will also need to set the NAMES property (since the options are likely student records). Names will be the Student datasource projection of whatever string field you want to appear in the options list.
I have a requirement where I need to create a list of all missing labels in any particular object.
For example.
I want to create a new table with a couple of fields and an overridden method. Now, suppose I am setting up the table property label as "Car details" similarly I am creating new fields and setting their label properties as "Car" and "Model" respectively and overriding validateWrite method with the error "Car-model combination not valid". But, I am not creating a label for any one of them. So now I want to write a job which will show that I need to create three missing labels.
I know Best practice check will give me warnings for the above scenario but I need it as a list as I'll use this list to enhance the Label editor.
Thanks in advance.
You could loop through the AOT using the TreeNode class and select elements where the label property is blank. Then you can send the information out to the infolog or whatever you wish.
There are numerous code examples out there of how to do that, such as this one looping over forms selecting on the HTMLHelpTopic property.
I have the following problem.
The LogisticsPostalAddress form is displaying the StreetInKana field. (this holds special characters used in Japan". The underlying EDT extends an EDT which has 'JPN' in the CountryRegionCodes property. The company I am using has primary address with country'GBR'. My understanding is that this should mean the field would be hidden, but it is not. So far we have made very few changes to standard AX code, and nothing that would be related. So either I have set something up wrong, or these fields are meant to be displayed, which would surprise me. Any ideas?
You have to change the property CountryRegionContextField of the corresponding control to point to the field which has CountryRegionCodes value set (either on table level, or EDT level).
I guess you have to explicitly set this property because you can have different forms with the same table as data source, but restrict access only on some of them.