Printing field value on label - axapta

I have created a menu item, which i added onto an ActionPane. The Menu Item runs an Output menu item which runs a Report. What I want to accomplish is, when a user clicks the menu item I want AX2012 to directly print the report.
display str ItemID(ItemId itemId)
{
str returnValue;
InventTable inventTable;
;
returnValue = this.ItemId;
return returnValue;
}
I am returning the ItemId on the report. How I can trigger AX2012 to directly print the report (with the ItemId) when the menu button is clicked?

Related

run time error opening a new window by selecting a table content

I have the following slot from a push-button click that opens a new window.
void StageTwoPatients::on_pushButton_Open_clicked()
{
QModelIndexList selection=ui->tableWidget->selectionModel()->selectedRows(0);
this-> close();
StageOneMain *newPatient = new StageOneMain(selection[0].data().toString(),this);
newPatient-> show();
}
Here user needs to select a row from a table and click pushbutton to open a new window.
If the user dont select a row accidentally and click the push button I get runtime error as shown here. How do I tell user using a QMessageBox that they should select a row before click push button?
Thanks in advance.
If the user dont select a row accidentally and click the push button I get runtime error
Simply do nothing if there is no selection.
void StageTwoPatients::on_pushButton_Open_clicked()
{
QModelIndexList selection=ui->tableWidget->selectionModel()->selectedRows(0);
if (selection.empty()){
return;
}
...
}

navigate the database records 1 by 1 like in a Queue System

I'm Building A Queue System, and want to click a button "Next" "CallAgain" and "NoShow" as of now when I click my "Next" Button, it only shows the first record from my database. I'm quite stuck right now , I want to click the "Next" Button over and over again and show me the next record.
public PartialViewResult BtnNext(int current = 0)
{
System.Threading.Thread.Sleep(1000);
var model = db.Queues.OrderBy(x => x.QueueNumber).Skip(current).Take(1);
return PartialView("_queuenumber", model);
}
I expect to click this button over and over again and will show me the next record from the database whenever I click it, thankyou. (super newbie)

Dimension field in AX 2009 report dialog?

Under ax 2009 my requirement is to open a dialog box when I opens a report and it should show a drop down. So currently my drop down is SiteId from InventSite table. As show in code below.
public class ReportRun extends ObjectRun
{
//Dialog
DialogField dfSiteName;
//Range
InventSiteId siteName;
}
public boolean getFromDialog()
{
;
siteName = dfSiteName.value();
return true;
}
public Object dialog(Object _dialog)
{
DialogRunBase dialog;
FormDateControl siteNameControl;
;
dialog = super(_dialog);
dialog.caption("Sales Overview Range Dialog");
dialog.addGroup("Selec Range");
dfSiteName = dialog.addField(typeid(InventSiteId),"Site","Select Range");
siteNameControl = dfSiteName.control();
siteNameControl.mandatory(true);
return dialog;
}
Everything is working fine with this code. Now instead drop down of SiteId from InventSite table in dialog box I want drop down of Dimension[1] from InventSite table in dialog box. I am not able to do that. Please guide me on this.
If you code work fine and you want to add only the Dimension[1] from inventSite table go to AOT\Data Dictionary\Tables\InventSite\Field Groups\AutoLookup here you there you will see SiteId and Name fields. You need to add new field then go to properties of this new field and select in property DataField the field that you need.
If you add this new field will be visible in all lookups for InventSiteId edt.

JavaFX Split Menu Button Arrow Trigger Event save clicked item in string

I have a SplitMenuButton, and I can't seem to find a way to trigger an event when the user clicks the arrow next to the button.
I would like to select item from dropdown(when mouse clicked on that item), display that in splitmenubutton and store value of that item in string to send to database.
I am not sure which event can do that, and I can not find any info on this either.
You can do something like.
for (final MenuItem item : smb.getItems()) {
item.setOnAction((event) -> {
System.out.println("Selected!");
});
}

Why does Qt list pane indicate there is a selection, even when the user does not select an item and no item appears as selected?

I do not understand why a selection is returned by my QListView, even when the user does not select an item, no item appears as selected, and clearSelection() is called on the pane before it is displayed.
Here is the relevant code that creates the list items:
class WidgetInstanceIdentifier {...} // This class is properly registered with Qt
listpane = new QListView(...);
QStandardItemModel * model = new QStandardItemModel(listpane);
int index = 0;
std::for_each(vg_list.cbegin(), vg_list.cend(), [&](WidgetInstanceIdentifier const & vg)
{
QStandardItem * item = new QStandardItem();
std::string text = "...";
item->setText(text.c_str());
item->setEditable(false);
item->setCheckable(false);
QVariant v;
v.setValue(vg);
item->setData(v);
model->setItem( index, item );
++index;
});
model->sort(0);
listpane->setModel(model);
listpane->clearSelection();
Here is a screenshot showing the dialog at the moment I click "OK". Notice that neither item in the list pane is selected:
... And here is the relevant code that tests for the selection:
QItemSelectionModel * listpane_selectionModel = listpane->selectionModel();
QModelIndex selectedIndex = listpane_selectionModel->currentIndex();
if (!selectedIndex.isValid())
{
// This block of code is not hit!!!!!!
// I expect it would be hit
}
QVariant vg_variant = listpaneModel->item(selectedIndex.row())->data();
// The following variable is properly set to correct data representing
// the first item in the list
vg_to_use = vg_variant.value<WidgetInstanceIdentifier>();
As noted in the code, the block of code that I expect to be hit in the case of "no selection" - the if (!selectedIndex.isValid()) {...} block - is not hit. Instead, the first item in the list is returned, as though it is selected. This is not desired! The user has no way to know which item is really being selected.
What am I misunderstanding? Why does Qt seem to report that there is a valid selection, even with no item selected in the list? What is the proper way to check if there is really no item selected?
I think selected item and current item are not the same things. Although, in some cases current item can be selected too, but this is not necessarily. Usually the current item indicated by the dashed outline in the view. Thus, if you want to check selection items count do it with QItemSelectionModel::selectedIndexes() function, i.e.:
QModelIndexList selected = listpane_selectionModel->selectedIndexes();
if (!selected.isEmpty()) {
// do something
}

Resources