Luegisdorf
10/21/2005 6:29:00 AM
Hi T
you need additionally to check if the field is empty or not (to set
mandatory property on a data source just makes some red lines, but not more).
overwrite the data source''s validateWrite() method
(fromXY/DataSources/YourDataSourceTable/methods) and but after ''ret =
super()'' this code:
ret = this.object(fieldnum(MyTable, MandaotryCredtLimit)).mandatory() && !
myTable.MandatoryCreditLimit ? checkfailed(strfmt("@SYS26332", new
DictField(fieldnum(MyTable, MandatoryCreditLimit)).label())) : ret;
I hope the brackets are correct (code was written direct in here ...)
Best regards
Patrick
"T-AIM" wrote:
> Thank you so much Patrick, that is excatly what i wanted. I have tested this
> but still not forcing the user to input a value > 0.00 Is there a commit just
> after setting the property? When will it take effect?
>
> Thank you for all your help.
> Kind Regards
> T
>
> "Luegisdorf" wrote:
>
> > Hi T-AIM
> >
> > If I understand you right way you want to set a field mandatory at runtime?
> >
> > I yes, so look your code again with some new code
> >
> > boolean validateField(fieldId p1)
> > {
> > boolean ret;
> > FormDataSource fds;
> >
> > ret = super(p1);
> >
> > switch (p1)
> > {
> > case fieldNum(CustTable, VATNum) :
> > ret = TaxVATNumTable::checkVATNum(this.VATNum, this, p1);
> > break;
> > case fieldNum(CustTable, CustGroup) :
> > if (this.CustGroup == "Cash")
> > {
> > this.MandatoryCreditLimit = 1;
> > if (this.isFormDataSource)
> > {
> > fds = this.dataSource();
> > fds.object(fieldnum(MyTable,
> > MandaotryCredtLimit)).mandatory(true);
> > }
> > //after a field check, the field maybe will mandatory
> >
> > }
> >
> > case fieldNum(CustTable, CreditMax) :
> > if (this.creditMax < 0)
> > {
> > ret = checkFailed("@SYS69970");
> > }
> > break;
> > }
> >
> > return ret;
> > }
> >
> > Hope this helps. Feel free to ask if that wasn''t that you want or if you
> > have further questions.
> >
> > Best regards
> > Patrick
> >
> > > Many thanks
> > > T-AIM