vrijdag 25 februari 2011

real formatting–.NET style

public display String30 displayLabelQty()
{
    String30   labelQty = System.String::Format("{0:.##}", tempTable.LabelQty);
    ;

    return strfmt("@SYS76498", labelQty, InventTable::find(this.displayItemId()).inventUnitId());
}

refresh() - refreshEx() - reread() - research() - executeQuery()

refresh() will not reread the record from the database. 
It basically just refreshes the screen with whatever is stored in the form cache.

refreshEx() will refresh the view of the records.

reread() will only re-read the CURRENT record from the DB so you should not use it to refresh the form data if you have added/removed records. 
It's often used if you change some values in the current record in some code, and commit them to the database using .update() on the table, instead of through the form datasource.
In this case .reread() will make those changes appear on the form.

research() will rerun the existing form query against the datasource, therefore updating the list with new/removed records as well as updating existing ones. 
This will honour any existing filters and sorting on the form.

executeQuery() is another useful one.  It should be used if you have modified the query in your code and need to refresh the form.
It's like .research() except it takes query changes into account.

Source: http://www.mail-archive.com/axapta-knowledge-village@yahoogroups.com/msg19026.html

Nerd smileSee also http://kashperuk.blogspot.com/2010/03/tutorial-reread-refresh-research.html for detailed explanation.

Use Pack/Unpack on Form

See http://daxguy.blogspot.com/2006/12/use-packunpack-on-form.html

Example on \Forms\AddressZipCodeLookup
Example with pack/unpack of printJobSettings on \Forms\SysTableForm