TV Diary Template Data Entry

Discussions about CSEntry
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

TV Diary Template Data Entry

Post by lukman.manggo »

Dear All
Dear CS Pro Expert

Would you please provide me a template of Data Entry for TV Diary as text table below.
The variables :
1. Time :to watching TV : 1 - 24 (Coded 1 for 1am, 2 for 2am and on)
2. TV: TV Station (Coded 1 for TV1, 2 for TV2 etc )
3. Level: of attention (Coded 1 for High, 2 for Middle, 3 for low)

Thank you very much for your help.

The Diary Table like this:
Time | TV Station | Level of Attention
|===========================================|======================
TV1 | TV2 | TV3 | TV4 .. TVOthers 1 | High | Middle | low
1am
2am
3am
4am
5am
on and on
Attachments
TVDAIRY.PNG
TVDAIRY.PNG (18.54 KiB) Viewed 10454 times
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Re: TV Diary Template Data Entry

Post by lukman.manggo »

Hi Master
Josh, Martin please

Needs your help pls. I am new on CS Pro.

In continuation of my previous one on this thread, I have created rooster for this and made some logic.
1. how to prevent "lines variable" from duplicate entry ?
3. and I want to put the pop up message to "Add Another Lines"
2. I want change the "lines variable" data type to num, instead of Alpha, and tried to change blank "" to notApp, but its not work at all on my logic.

Please see the attached files.

Your help highly appreciate.
Million thanks in advance.


Below my logic that I get from CSPro 6.1\Examples\1 - Data Entry\Simple CAPI
==========================
{Application 'MT' logic file generated by CSPro}
PROC GLOBAL

numeric vsItr;

// a counter variable
numeric ctr;

array string vsLabels(100);

PROC MT_FF

PROC LINE1
// a blank name indicates the end of the household
if LINE1 = "" then

if curocc() = 1 then
errmsg("Please entry at least one.");
reenter;
endif;

// confirm that this is really the end of line and not an inadvertent blank
numeric numOfLines = curocc() - 1;

vsItr = 1;

do ctr = 1 while ctr <= numOfLines
vsLabels(vsItr) = "Edit " + LINE1(ctr);
inc(vsItr);
enddo;

vsLabels(vsItr) = "Add Another Lines";
inc(vsItr);

vsLabels(vsItr) = "End Entry";
inc(vsItr);

vsLabels(vsItr) = ""; // end the accept array

numeric selection = accept("Are you finished entering lines ?",vsLabels);

if selection in 1:numOfLines then // the interviewer selected a person
reenter LINE1(selection);

elseif selection = ( vsItr - 1 ) then // finished with the line roster
endgroup;

else
reenter;

endif;

endif;


PROC TV2

if TV2 = TV1 then
errmsg ("%d is duplicate", TV1);
reenter;
endif;

==========================

Lukman
Attachments
mt.7z
(1.92 KiB) Downloaded 314 times
dupl_rooster.PNG
dupl_rooster.PNG (23.39 KiB) Viewed 10403 times
jfigueroa
Posts: 100
Joined: August 28th, 2014, 12:46 pm

Re: TV Diary Template Data Entry

Post by jfigueroa »

Hi lukman.manggo,

You haven´t attached files on the .7z folder you sent.
If you can attach all your program with the Pack Application Tool, so that way we can help you in some way.

Regards.
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Re: TV Diary Template Data Entry

Post by lukman.manggo »

hi jfigueroa

Its been attached file name: mt.7z

here it is i reattached on zipped by cspro pack applicatio but using. file name mt.zip

Cheers
Lukman
Attachments
MT.zip
(2.89 KiB) Downloaded 313 times
jfigueroa
Posts: 100
Joined: August 28th, 2014, 12:46 pm

Re: TV Diary Template Data Entry

Post by jfigueroa »

Hi lukman.manggo,

I think this is what you wanted to do.

What I done was to change the dictionary variable type LINE1 to num:
Line1.JPG
Line1.JPG (15.29 KiB) Viewed 10355 times
Then, add the special value NotApp on its value set:
Line2.JPG
Line2.JPG (10.42 KiB) Viewed 10355 times
Next, modify on logic to change it for blank numeric value notApp:

Code: Select all

// a blank name indicates the end of the household
	if LINE1 = notappl then
	
		if curocc() = 1 then
			errmsg("Please entry at least one.");
			reenter;
	endif;
Last, use the Edit() function so you can add it to your labels array.

Code: Select all

// confirm that this is really the end of line and not an inadvertent blank
		numeric numOfLines = curocc() - 1;

		vsItr = 1;
		
		do ctr = 1 while ctr <= numOfLines
			vsLabels(vsItr) = "Edit " + Edit("99",LINE1(ctr));
			inc(vsItr);
		enddo;
		...
There is your program with this changes on the attached .zip file below.
Hope that´s what you wanted.
Regards.
Attachments
mt(2).zip
(2.83 KiB) Downloaded 307 times
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Re: TV Diary Template Data Entry

Post by lukman.manggo »

My friend jfigueroa

Thank so much for your guiding. Really appreciate. The syntax is working good.

Now, on pop up messege when the Line field is blank, I want to remove the 'edit' option. And put the End Entry on the top. So the errmsg would
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Re: TV Diary Template Data Entry

Post by lukman.manggo »

So only two choises on the screen appears.
1. End - Ending rooster , on top, the cursor will be here as first choise
* Back/Add - Back to last empty line, down arrow buttom

Thanks jfigueroa for your time to help me.
jfigueroa
Posts: 100
Joined: August 28th, 2014, 12:46 pm

Re: TV Diary Template Data Entry

Post by jfigueroa »

Hi lukman.manggo,

Just have one question on what you are asking.
For displaying this two choices you still need to conserve your labels array for anything else? Or you don´t mind on discarding the labels array?

Regards.
lukman.manggo
Posts: 13
Joined: October 14th, 2016, 3:22 am

Re: TV Diary Template Data Entry

Post by lukman.manggo »

Hi jfigueroa

Thanks for quick prompt.
The output of data entry I will convert to spss. Since I am still new on CSPro syntax, so the setting value and labeling mostly I did on SPSS. Even for consistency check.

If you dont mind please give me the example for discarding, example of preserving the label array too, would you.
Lets each variable only have 3 value set (cmiw, that more label we put on then more long the syntax we should make?).
So the output would be clean and ready to tabulate, could it be?

Many thanks jfigueroa.
jfigueroa
Posts: 100
Joined: August 28th, 2014, 12:46 pm

Re: TV Diary Template Data Entry

Post by jfigueroa »

Hi lukman.manggo,

Here I attached the .zip file of your program with the changes you asked.
It´s still adding the labels you enter in the roster to the labels array, so that way you can use it in any other thing you need.

The point here to do what you wanted with the accept options is to write them in the order you need, and then you just have to create the condition acord to it.
Just like below:

Code: Select all

	//In this case you only want to show 2 options on the accept pop-up 
	//So you write only the 2 of them in the order you want it to show on the pop-up message.
	//For this case First: "End Entry" and then (second) "Add Another Lines". Just as below.
	
	numeric selection = accept("Are you finished entering lines ?", "End Entry", "Add Another Lines");
	
	//Condition acording to what user chose
	if selection = 1 then //Ending roster
		endgroup;
	else
		if selection = 2 then // Add/Back
			reenter LINE1;
		endif;
	endif;
Hope to help you in some way.
And remember practice makes perfect. So don´t worry if on start is a bit difficult, with time you are going to be improving. Just like all of us.
Regards from Guatemala.
Attachments
mt (2).zip
(3 KiB) Downloaded 363 times
Post Reply