Correct me if I dont understand your problem well. I presume that InventTrans table is your forms datasource and thereby the field DatePhysical already is there. Anyway, in your code you add the table as datasource.
The DatePhysical is of the type ETD DatePhysical. This ETD has some properties DateYear, DateMonth and DateDay. If you set the last(DateDay) to "Day not shown", doesn't that solve the problem?
void init()
{
InventTrans tblInventTrans;
Str dateStr;
Int intmth;
Int intyear;
;
super();
while select DatePhysical from tblInventTrans
group by DatePhysical
asc
{
intmth = mthofyr(tblInventTrans.DatePhysical);
intyear = year(tblInventTrans.DatePhysical);
dateStr = int2str(intmth)+ "/" +int2str(intyear);
info(strfmt("Month and year of transaction: %1", dateStr));
dateStr = "";
}
}
Comments
please tell us what you want to achieve with the SQL-statement. Maybe it can be achieved without SQL.
Lars
Query query;
QueryBuildDatasource qbs;
super();
query = new query() ;
qbs = query.addDataSource(tablenum(InventTrans));
qbs.name(inventTrans_ds.name());
qbs.addSortField(fieldNum(inventTrans,Direction));
qbs.addRange(fieldNum(inventTrans,Direction)).value(queryValue(InventDirection::Issue));
qbs.fields().addField(fieldNum(inventTrans,qty),SelectionField::SUM);
//qbs.fields().addField(fieldnum(inventTrans,DatePhysical));
qbs.orderMode(OrderMode::GROUPBY);
inventTrans_ds.query(query);
I want to display the month + the year of the DatePhysical and group by the result.
Service Informatique
Tél. 03 84 91 24 50
Fax. 03 84 91 24 51
Correct me if I dont understand your problem well. I presume that InventTrans table is your forms datasource and thereby the field DatePhysical already is there. Anyway, in your code you add the table as datasource.
The DatePhysical is of the type ETD DatePhysical. This ETD has some properties DateYear, DateMonth and DateDay. If you set the last(DateDay) to "Day not shown", doesn't that solve the problem?
Lars
i would like to code a statement like that :
qbs.fields().addField(fieldnum(inventTrans,DatePhysical),mthofyr(DatePhysical) + "/" + year(DatePhysical));
and i want this result :
03/2006 5
04/2006 -3
05/2006 65
....
Service Informatique
Tél. 03 84 91 24 50
Fax. 03 84 91 24 51
I understand. I think it is something like below:
void init()
{
InventTrans tblInventTrans;
Str dateStr;
Int intmth;
Int intyear;
;
super();
while select DatePhysical from tblInventTrans
group by DatePhysical
asc
{
intmth = mthofyr(tblInventTrans.DatePhysical);
intyear = year(tblInventTrans.DatePhysical);
dateStr = int2str(intmth)+ "/" +int2str(intyear);
info(strfmt("Month and year of transaction: %1", dateStr));
dateStr = "";
}
}
I hope you can use my answer.
Lars
In a report that's easy but in forms i don't know how to do.
Thanks for your help.
Service Informatique
Tél. 03 84 91 24 50
Fax. 03 84 91 24 51
is it in new form the result should be shown?
Lars
In the inventable form, i made a menuItem wich call a new form with the itemid in parameters(already make).
In this new form i want to display all inventtrans with sum of quantity and group by month (in a datagrid).
Service Informatique
Tél. 03 84 91 24 50
Fax. 03 84 91 24 51
have you found a solution to your problem?
Lars