How to get a variable value after Loadcase statement

Discussions about CSEntry
Post Reply
munirmdee1
Posts: 75
Joined: August 17th, 2015, 9:32 am
Location: Dar es Salaam, Tanzania

How to get a variable value after Loadcase statement

Post by munirmdee1 »

Hi everyone, I have one problem here, I'm stack somewhere. I created a Menu Application for my Data entry application, the following are files for my Menu Application; Menu.dcf, Menu.fmf,Menu.ent and Menu.pff. In my dictionary there are Variables as follows; Region, District, Ward, Village and EA. But also I have another dictionary which is an external dictionary, which id ALLEA.dcf, which has ID Variables as Region,District,Ward,Village and EA. But has other variables like FE, and SE which are not in the ID, they are other variables in another record after the ID.

What I need is, when Data entrant enter the Region, District, Ward, Village and EA in the menu, then the External dictionary ALLEA.dcf should load the same Identification from the external file to see if the Identification exists(is correct). This one is done correctly, I use Loadcase and I put the identification combination and it loads fine, but the problem is I can not get the value of FE and SE after loading the case from external dictionary and file, remember FE and SE are two variables not in the Identification, they are in the Record just after the Identification. See the following sytax:

ok = loadcase(ALLEA,Region,District,Ward,Village,EA);

That one works fine, but the following does not work:

errmsg("FE = %d and SE = %d", FE,SE);

from the above errmsg i get the following:

FE = NOAPPL and SE = NOTAPPL

Which means, the values of FE and SE are not loaded, the question is why, is it because they are not part of the case identification or?

Help please...looking forward to hear from you...

Thanks in advance
Munir Mdee
Software Programmer
National Bureau of Statistic (NBS)
Jakaya Kikwete Road,
P.O.Box 2683,
Dodoma,TANZANIA
Mob: +255 755 740090
Email: munir.mdee@nbs.go.tz
munirmdee@gmail.com
munirmdee1
Posts: 75
Joined: August 17th, 2015, 9:32 am
Location: Dar es Salaam, Tanzania

Re: How to get a variable value after Loadcase statement

Post by munirmdee1 »

Actually I found out whats a problem, but I can not solve the problem. The problem is it does not load the case correctly, actually consider the following example:
If data entrant inputs the following:
Region = 15
District = 01
Ward = 043
Village = 05
EA = 009

If I print out an errmsg after the loadcase statement, it gives me this:
Region = 10
Dsitrict = 43
Ward = 50
Village = 9
EA = DEFAULT
FE = NOTAPPL
SE = NOTAPPL

What I dicovered ther is, it does not read starting from Region, it starts from second digit of a District, thats why it put 10 in region and 43 in District as it is seen above.
My question is, why it shift and start reading at the 4th digit and leave first three digits(that is 150)?

Help please...
Munir Mdee
Software Programmer
National Bureau of Statistic (NBS)
Jakaya Kikwete Road,
P.O.Box 2683,
Dodoma,TANZANIA
Mob: +255 755 740090
Email: munir.mdee@nbs.go.tz
munirmdee@gmail.com
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to get a variable value after Loadcase statement

Post by josh »

Most likely your data does not match your dictionary. Look at the start positions and sizes of the variables in the external dictionary and make sure that they match exactly the columns in the data that the values start on. You may need to adjust your dictionary to match your data or vice versa.
munirmdee1
Posts: 75
Joined: August 17th, 2015, 9:32 am
Location: Dar es Salaam, Tanzania

Re: How to get a variable value after Loadcase statement

Post by munirmdee1 »

Thanks Josh, actually I have created another application just to open all the cases in MODIFY mode in the data file using the same dictionary that I use in Menu application as an external, and it opens and it works fine, I mean the dictionary and data file matches or otherwise it could not open/load.

Huh!!, Josh consider the following logic statements:

PROC EA
Preproc
// Assigning values from Menu.dcf variables to ALLEA.dcf variables
Region = Region1;
District = District1;
Ward = Ward1;
Village = Village1;
EA = EA1;
Postproc
If Loadcase(ALLEA,Region,District,Ward,Village,EA) then
errmsg("The EA is %d-%d-%d-%d-%d");
Endif;

NB: Assume a user entered the following values into respective fields/variables:
Region1 = 15
District = 01
Ward = 043
Village = 05
EA = 009

From the errmsg above im getting this message(it display the following message):
10-43-50-9
See the way it shifts to the right, Whis is wrong, as I told you above, when I used the same dictionary (that is ALLEA.dcf) and created application to load all EAs in MODIFY mode, it loads all the EAs in allea.dat which is the data file, and all cases are displayed on the left side(cases tree) and I can click at any particular case and it display its content correctly. I tried to troubleshoot but I still see nothing, the dictionary and the size and the format are all ok.
Munir Mdee
Software Programmer
National Bureau of Statistic (NBS)
Jakaya Kikwete Road,
P.O.Box 2683,
Dodoma,TANZANIA
Mob: +255 755 740090
Email: munir.mdee@nbs.go.tz
munirmdee@gmail.com
munirmdee1
Posts: 75
Joined: August 17th, 2015, 9:32 am
Location: Dar es Salaam, Tanzania

Re: How to get a variable value after Loadcase statement

Post by munirmdee1 »

Thanks Josh, actually I have created another application just to open all the cases in MODIFY mode in the data file using the same dictionary that I use in Menu application as an external, and it opens and it works fine, I mean the dictionary and data file matches or otherwise it could not open/load.

Huh!!, Josh consider the following logic statements:

PROC EA
Preproc
// Assigning values from Menu.dcf variables to ALLEA.dcf variables
Region = Region1;
District = District1;
Ward = Ward1;
Village = Village1;
EA = EA1;
Postproc
If Loadcase(ALLEA,Region,District,Ward,Village,EA) then
errmsg("The EA is %d-%d-%d-%d-%d",Region,District,Ward,Village,EA);
Endif;

NB: Assume a user entered the following values into respective fields/variables:
Region1 = 15
District = 01
Ward = 043
Village = 05
EA = 009

From the errmsg above im getting this message(it display the following message):
10-43-50-9
See the way it shifts to the right, Whis is wrong, as I told you above, when I used the same dictionary (that is ALLEA.dcf) and created application to load all EAs in MODIFY mode, it loads all the EAs in allea.dat which is the data file, and all cases are displayed on the left side(cases tree) and I can click at any particular case and it display its content correctly. I tried to troubleshoot but I still see nothing, the dictionary and the size and the format are all ok.
Munir Mdee
Software Programmer
National Bureau of Statistic (NBS)
Jakaya Kikwete Road,
P.O.Box 2683,
Dodoma,TANZANIA
Mob: +255 755 740090
Email: munir.mdee@nbs.go.tz
munirmdee@gmail.com
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to get a variable value after Loadcase statement

Post by josh »

I'm pretty sure it is a mismatch between dictionary and data file but if you post you applications and data files I'll take a closer look.
Post Reply