Passing combobox have ENUMTYPE from a form to a report

hi all

i have form have combobox and this combobox read data from ENUM type function and the data is choice 2

option

1- AR (arbic lang)

2-EN (english ang)

what i need

1-when i choose the AR that mean i choose Global::numeralsToTxt_AR_LA(iCheckAmount);

if -EN (english ang) mean i choose Global::numeralsToTxt_en(iCheckAmount);

but in report not in form i have summation num i need to change to the word in the report

see this code what i write and same one help me To get to it

in button in form i write like this

void clicked()

{ str sNote_Ref ;

str sEnum ;

SUM_CASHISSUEDETAIL_View5 CheckIssue1 ;

Args args = new args();

ReportRun reportRun;

;

while SELECT CheckIssueRef from CheckIssue1 where CheckIssue1.CheckIssueRef==CheckIssue.CheckIssueRef

sNote_Ref = CheckIssue.CheckIssueRef ;

//******here i define what is inside combobox to parameter my problem i cant pass to the report ************************************////////////////////

if (EN_AR.selection() == EN_AR_ENUMS::ar )

{

args.parm(‘AR’);

args.caller(EN_AR);

}

else {

args.parm(‘EN’);}

// info(sNote_Ref);

//+

args.parm(CheckIssue.CheckIssueRef);

// info(EN_AR.text()) ;

// info(num2str(EN_AR.,0,0,0,0));

args.name(reportstr(CHECKISSUE_Report));

reportRun = classFactory.reportRunClass(args);

reportRun.init();

reportrun.run();

super();

}

in report i create display str amt2txt()

1-to create Control string in report to use the method to show me number to word text from Global class numeralsToTxt_AR_LA or numeralsToTxt_en

i write code like this

display str amt2txt()

{str ParmCaller ;

str sTafqeet;

int iCheckAmount ;

Args args = new args();

while SELECT SumOfAmount from SUM_CASHISSUEDETAIL_View5

where SUM_CASHISSUEDETAIL_View5.CheckIssueRef==CheckIssue.CheckIssueRef

//if(SUM_CASHISSUEDETAIL_View5.combobox(it is the enum right) == Enum::ar)

//{sTafqeet = Global::numeralsToTxt_AR_LA(iCheckAmount); }

//if (EN_AR.selection() == EN_AR_ENUMS::ar )

// {

if(element.args().parm(‘AR’ )==Args.parm(‘AR’))

{info( ‘AR’ );

iCheckAmount = SUM_CASHISSUEDETAIL_View5.SumOfAmount ;

sTafqeet = Global::numeralsToTxt_AR_LA(iCheckAmount);}

else {

info(element.args().parm(‘EN’ ));

iCheckAmount = SUM_CASHISSUEDETAIL_View5.SumOfAmount ;

sTafqeet = Global::numeralsToTxt_EN(iCheckAmount);

}

//}

//else

//{

//iCheckAmount = SUM_CASHISSUEDETAIL_View5.SumOfAmount ;

//sTafqeet = Global::numeralsToTxt_EN(iCheckAmount);

//}

// sTafqeet = Global::numeralsToTxt_AR_LA(iCheckAmount);

CheckIssue_BeneficiaryName.alignment(1);

return sTafqeet;

}

and in report must be show it by Serial number specific i write in init function and passing from form to report
code like this

public void init()
{
;
try
{
if(element.args().parm())
{
this.query().dataSourceTable(tablenum(CheckIssue))
.addRange(fieldnum(CheckIssue,CheckIssueRef )).value(element.args().parm());

this.query().userUpdate(false);
this.query().interactive(false);
super();
}
}

catch(exception::Error)
{
// info(“Error in init method”);
}

}

//****** my problem i cant pass to the report what is inside combobox ************************************////////////////////

i hope to help me
thanks all

Hi Bas,

One thing let me know, the combo box which in the form it is the table field or it is that contol is added in the form level only…

Naresh Kolli

hi Mr. Naresh Kolli

it is not from the table field

from datadictionary ====>> BASE ENUMBER i create EN_AR_ENUMS function and have AR , EN element

in properties combobox have Enum type i put function EN_AR_ENUMS to show me element (AR , EN)

how can i passing to report

thanks for ur hlep MR .Naresh Kolli

HI Bas,

Make AutoDeclaration yes to ComboBox in the form

args.parm(combobox.valuestr()) try this it may work…

Naresh Kolli

thanks for u

i will try

hi mr.Naresh Kolli

I tried this function

I have a query this function

i will put in button (void clicked() function ) or in report display str amt2txt()

if in void clicked() function

i need the function to call this args.parm in report display str amt2txt() Through combobox

i give u example to be More pronounced

in form

i have some control from this control 1 combobox

ok

when i drop down (click) this combobox give me to Two choices

1- ar

2 -EN

ok

now i have button what we create in beginning when i click

what happen

it open the report

ok

in report we create the function display str amt2txt()

here what i need

now by ur function args.parm(combobox.valuestr())

i put my argument inside args.parm

mean i select ar or en inside args.parm

my question here

how i passing this args.parm in report in function display str amt2txt()

and how i put this args.parm with if function

in report in function display str amt2txt()

if (args.parm =‘AR’)

{ the function }

I hope that this illustration and example may clarify the desired

thanks for ur helps

Hi Bas,

In Form ,button clicked method

void clicked()
{
Args args = new args();
ReportRun reportRun;
;
args.parm(ComboBox.valueStr());
args.record(EmplTable);
args.name(reportstr(report2));
reportRun = classFactory.reportRunClass(args);
reportRun.init();
reportrun.run();

super();
}

In the report init() method…

public void init()
{
EmplTable empTable;
emplId emplId;
;
try
{
if(element.args().parm())
{
s = element.args().parm(); //combo box value… declare the variable s in the class declaration…
empTable = element.args().record();
this.query().dataSourceTable(tablenum(EmplTable)).addRange(fieldnum(EmplTable,EmplId)).value(empTable.EmplId);
this.query().userUpdate(false);
this.query().interactive(false);
super();
}
}
catch(exception::Error)
{
info(“Error in init method”);
}
}

So you can use that variable in the display method to diaplay accordingly…

Naresh Kolli

thank u very match for help

i thing we have only one step

i do with function every thin g u sent to

see now

1- I declare the variable S in the class declaration

public class ReportRun extends ObjectRun

{

str S ;

}

2- i add S = element.args().parm(); in public void init()

public void init()

{

;

try

{

if(element.args().parm())

{

S = element.args().parm();

this.query().dataSourceTable(tablenum(CheckIssue))

.addRange(fieldnum(CheckIssue,CheckIssueRef )).value(element.args().parm());

this.query().userUpdate(false);

this.query().interactive(false);

super();

}

}

catch(exception::Error)

{

// info(“Error in init method”);

}

3- i add in void clicked()

args.parm(EN_AR.valueStr());

void clicked()
{ str sNote_Ref ;
str sEnum ;
int nCoun_Check ;

CHECK_NUMBER_TABLE CHECK_NUMBER_TABLE1;

SUM_CASHISSUEDETAIL_View5 CheckIssue1 ;
Args args = new args();
ReportRun reportRun;
;

args.parm(EN_AR.valueStr());

while select * from CHECK_NUMBER_TABLE1
where CHECK_NUMBER_TABLE1.CheckNumber == CheckIssue.CheckNumber

nCoun_Check=CHECK_NUMBER_TABLE1.count_check ;

if ( nCoun_Check >= 1 )

{
if(EN_AR.valueStr() ==‘EN’){
box::warning(“This Report Was Print.”,“PRINT”,“Help text”);
}
else
{
box::warning(‘تم طباعة هذا التقرير مسبقاً’,‘الطباعة’);
}
}
else
{
while SELECT CheckIssueRef from CheckIssue1 where CheckIssue1.CheckIssueRef==CheckIssue.CheckIssueRef

sNote_Ref = CheckIssue.CheckIssueRef ;

info(args.parm(EN_AR.valueStr()));
//+
args.parm(CheckIssue.CheckIssueRef);

// info(EN_AR.text()) ;
// info(num2str(EN_AR.,0,0,0,0));
args.name(reportstr(CHECKISSUE_Report));
reportRun = classFactory.reportRunClass(args);
reportRun.init();
reportrun.run();

super();
}}
but the result in report with amt2txt it not right
maybe i forget something here only read after else (******) it not see the variable S is 'AR’
i don’t no why

if (S== AR )
{
iCheckAmount = SUM_CASHISSUEDETAIL_View5.SumOfAmount ;
sTafqeet = Global::numeralsToTxt_AR_LA(iCheckAmount);
}
else (******) {
iCheckAmount = SUM_CASHISSUEDETAIL_View5.SumOfAmount ;
sTafqeet = Global::numeralsToTxt_EN(iCheckAmount);
}

i am so sorry
pls
give me this last step i hope that

hi Naresh Kolli

i am waiting ur answerer

last question

i hope to answerer

thanks for help

HI bas,

the amount is not displaying right…i didnt get you…

Naresh Kolli

hi Naresh Kolli

i make this test in display str amt2txt()

info( s ) ;

when i click report give me empty field I declare the variable S in the class declaration

i thing i have some wrong i type pls help me to found

Hi Bas,

In display method

display str num2txt()
{
;
if( s == AR )
{
return Global::numeralsToTxt_AR_LA(iCheckAmount);
}
else if( s == EN )
{
return Global::numeralsToTxt_EN(iCheckAmount);
}
}
try this…

Naresh Kolli

hi

when i run give me this error

Error executing code: ReportRun (data source), method CopyOfamt2txt1 has no return command.



(C)\Reports\CHECKISSUE_Report\Methods\CopyOfamt2txt1 - line 27
(C)\Classes\ReportSection\executeSection
(C)\Classes\ReportRun\send
(C)\Classes\ReportRun\fetch
(C)\Classes\ReportRun\run
(C)\Classes\SysReportRun\run - line 26


i write like this 
display str  amt2txt1()

{str ParmCaller ;
str sTafqeet;
int iCheckAmount ;
Args args = new args();

  while SELECT    SumOfAmount  from SUM_CASHISSUEDETAIL_View5
   where SUM_CASHISSUEDETAIL_View5.CheckIssueRef==CheckIssue.CheckIssueRef

//if(SUM_CASHISSUEDETAIL_View5.combobox(it is the enum right) == Enum::ar)
//{sTafqeet =  Global::numeralsToTxt_AR_LA(iCheckAmount); }

//if (EN_AR.selection() == EN_AR_ENUMS::ar )
// {
// if(element.args().parm('AR' )==Args.parm('AR'))

iCheckAmount =     SUM_CASHISSUEDETAIL_View5.SumOfAmount  ;

  if( s == 'AR' )
    {
       return Global::numeralsToTxt_AR_LA(iCheckAmount);
    }
    else if( s == 'EN' )
    {
       return Global::numeralsToTxt_EN(iCheckAmount);
    }

//}

// else {

// info(element.args().parm('EN' ));
// iCheckAmount =     SUM_CASHISSUEDETAIL_View5.SumOfAmount  ;
//  sTafqeet =  Global::numeralsToTxt_EN(iCheckAmount);
// }
//}
//else
//{
//iCheckAmount =     SUM_CASHISSUEDETAIL_View5.SumOfAmount  ;
//sTafqeet =  Global::numeralsToTxt_EN(iCheckAmount);
//}
// sTafqeet =  Global::numeralsToTxt_AR_LA(iCheckAmount);

}

pls help me to fix it 

Hi Bas,

Don’t use args in the display method…get the combox value and store in the global variable which declared in the class declaration in the init() method of the report… use that varibale in the display method…

display str amt2txt1()
{
str ParmCaller ;
str sTafqeet;
int iCheckAmount ;
;
while SELECT sumOfAmount from SUM_CASHISSUEDETAIL_View5
where SUM_CASHISSUEDETAIL_View5.CheckIssueRef==CheckIssue.CheckIssueRef

iCheckAmount = SUM_CASHISSUEDETAIL_View5.SumOfAmount ;
if( s == ‘AR’ )
{
sTafqeet = Global::numeralsToTxt_AR_LA(iCheckAmount);
}
else if( s == ‘EN’ )
{
sTafqeet = Global::numeralsToTxt_EN(iCheckAmount);
}
return sTafqeet;
}

Naresh Kolli

i write the same function

i am so sorry again no error but also no result the contron in report is empty

if u can help me to make To review last init function maybe i write something wrong like display str function

this is last init

public void init()

{CheckIssue CheckIssue1 ;

;

try

{

if(element.args().parm())

{

S = element.args().parm();

CheckIssue1 = element.args().record();

this.query().dataSourceTable(tablenum(CheckIssue))

.addRange(fieldnum(CheckIssue,CheckIssueRef )).value(element.args().parm());

this.query().userUpdate(false);

this.query().interactive(false);

super();

}

}

catch(exception::Error)

{

info(“Error in init method”);

info(S) ;

}

}

thanks for ur help

sorry Naresh Kolli

i have question

S = element.args().parm(); this is function pass what data in the combobox

CheckIssue1 = element.args().record();

I need more clarification on this point

maybe i wrote somethin wrong

thank for ur help

HI bas…

Changes as

this.query().dataSourceTable(tablenum(CheckIssue)) .addRange(fieldnum(CheckIssue,CheckIssueRef )).value(CheckIssue1.CheckIssueRef);

try this it will work…

Naresh Kolli

sory we now have 2 parameter 1fr to get the serial-no the same in the form serial-no when i click buttom

and 2sec for combobox

this is for serial-no

this.query().dataSourceTable(tablenum(CheckIssue))

.addRange(fieldnum(CheckIssue,CheckIssueRef )).value(element.args().parm()); and it work right

maybe i need to add other args().parm for combobox or how u thing

i need ur help here

Hi Bas,

in the clicked method…

args.parm(comboBox.valustr()); //passing the conbobox value

args.record(CheckIssue) // passing the table record

in the init method

s = element.args.parm() //getting the combobox value and storing in the global variable

locCheckIssue = element.args.record; //declare the table buffer of CheckIssue locCheckIssue in the init method and assigning the record to that buffer…

**this.query().dataSourceTable(tablenum(CheckIssue)) .addRange(fieldnum(CheckIssue,CheckIssueRef )).value(**locCheckIssue .CheckIssueRef);

try this it will work…

Naresh Kolli…

sorry

i type all function

problem whith S

i am try many time to see data by info box give me empty +

what i do now to test S work or not work i write like this

if (S==‘AR’)

{

sTafqeet = Global::numeralsToTxt_AR_LA(125);

}

else if( S == ‘EN’ )

{

sTafqeet = Global::numeralsToTxt_EN(225);

i put number to see problem from iCheckAmount or s

i find s is empty because if statement not work

when i put the function sTafqeet = Global::numeralsToTxt_EN(225);

without if statement give me result

with if statement result is empty

i am so sorry again but i don’t know what i say accpt if u have help to fix this problem

thank for ur help