Numerator/denominator in popup window

Discussions about CSEntry
Post Reply
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Numerator/denominator in popup window

Post by lls »

Hi,

I would like to have fields with values expressed in percent but I would like keyers to enter a numerator and a denominator and have the % calculated autmatically.
Different indicators with different numerator/denominator combination as valuesets.

Is it possible to have a kind of pop up window where one would enter num/denom values instead of having the fields directly in the form?

Thank you.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Numerator/denominator in popup window

Post by josh »

You can use the prompt function. See the help for details.

Personally I would put them on the form and add a protected field that shows the computed percentage.
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Numerator/denominator in popup window

Post by lls »

Thank you.

I don't think this is what I'm looking for.

I would like to have different fields with numeric values automatically calculated. Some would be calculated simply from numerator/denominator but some other would be calculated based on a serie of yes/no questions with different weights.

For example

- if field 1: one would be required to answer 5 yes/no questions with a weight of 20 each. If all "yes" then = 100, if 4 "yes" then 80, etc.
- if field 2: one would be required to answer 10 yes/no question with a weight of 5, 10 or 20 each
etc.

I was thinking of a way to have a popup window to show up depending on the previous choice in which one would fill the "attributes", either num/denom or yes/no questions.

I guess the only way would be to create different forms and to jump to one or another?
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Numerator/denominator in popup window

Post by josh »

You could have them on the same form and use skip to move between the questions or you could use the prompt function.
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Numerator/denominator in popup window

Post by lls »

Thank you Josh,

I wanted to minimize the number of entry fields in the form but I guess your suggestion make more sense.

Can you please help me out with the following: I have numeric fields representing e.g. country, PPG, goals and alpha fields where I would like to have the label/name of the selected item. I tried several codes (after POSTPROC) but none of them works. Only "Region" works (it is not a dynamic value set from external file but a standard valueset). I guess I need to define (i)?? How can I do that?

Thank you,

lls

Code: Select all

PROC GOAL

preproc

{Use lookup file to select PPG as per operation}

	REGION_LU30 = REGION;
	OPERATION_LU30 = OPERATION;
	PPG_LU30 = PPG;
		
	If !loadcase(PPG_TO_GOAL_DICT,REGION_LU30,OPERATION_LU30,PPG_LU30) then
		errmsg("Invalid PPG code %d, please reenter", PPG_LU30);
		reenter PPG;
	endif;

	do varying i = 1 until i > count(PPG_TO_GOAL_DICT.PPG_TO_GOAL_REC)
		
		goalCodes(i) = GOALS_LU30(i);
		goalNames(i) = GOALS_NAME_LU30(i);
	enddo;
	goalCodes(i) = notappl; 
	
{Call setvalueset using the arrays that contain operations codes and names }
	
	setvalueset($, goalCodes, goalNames);
	setcapturetype($,1);

POSTPROC

{The below does not return anything}

GOAL_NAME = GOALS_NAME_LU30(i);
Attachments
1.PNG
1.PNG (3.13 KiB) Viewed 7516 times
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Numerator/denominator in popup window

Post by lls »

Hi, the code below will return the correct country (operation) name as far as the region is set to 1 (Africa). If Region is anything else (2,3,4,5) the country (operation) name is blank.
What am I missing?

Thank you

Code: Select all

PROC OPERATION
  
POSTPROC

loadcase(REGION_TO_OPERATION_DICT,OPERATIONS_LU10(i));

		i = OPERATION;

			OPERATION_NAME = OPERATIONS_NAME_LU10(i);
lls
Posts: 109
Joined: December 6th, 2011, 3:11 pm
Location: Geneva, Switzerland

Re: Numerator/denominator in popup window

Post by lls »

I'm stuck with the problem above...
please help
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Numerator/denominator in popup window

Post by josh »

It is hard to tell with just a code snippet. Use trace or errmsg to print out the values of the array. Perhaps element i is not filled in.
Post Reply