Need Help for Validation

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Need Help for Validation

Post by Socio »

I have a Question

Q1A (Total Children)
Q1B (Total Male)
Q1C (Total Female)

Q2A (Total Children Staying)
Q2B (Total Male Staying)
Q2C (Total Female Staying)

Q3A (Total Children migrate)
Q3B (Total Male migrate)
Q3C (Total Female migrate)

I need to code a validation where:

Q2A + Q3A = Q1A
Q2A OR Q3A < = Q1A

Q1B + Q1C = Q1A
Q2B + Q2C = Q2A
Q3B + Q3C = Q3A

Thank you
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Need Help for Validation

Post by khurshid.arshad »

Dear Socio
I hope it works for you.
a.

PROC Q3A

Code: Select all

if Q2A+Q3A<>Q1A then

		numeric result=accept ("Children Staying and Migrated not matched with Total children",
										   "Make correction in Total Children [Q1A]",                 {1}
										   "Make Correction in in Total Children Staying [Q2A]",      {2}
										   "Make Correction in in Total Children Migrated [Q3A]");    {3}

		if result=1 then
			move to Q1A;
		elseif result=2 then
			move to Q2A;
		elseif result=3 then
			reenter;
		endif;
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Re: Need Help for Validation

Post by Socio »

Mistake post
Last edited by Socio on October 26th, 2017, 4:09 am, edited 1 time in total.
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Re: Need Help for Validation

Post by Socio »

Dear khurshid.arshad

Thank you for the reply. Please ignore the above reply (I forgot to add endif; )
Here I'm putting up the original Question number.

Code: Select all

PROC EL107A
if EL106A+EL107A<>EL105A then
      numeric result=accept ("Children Staying and Migrated not matched with Total children",
                                 "Make correction in Total Children [EL105A]",                 {1}
                                 "Make Correction in in Total Children Staying [EL106A]",      {2}
                                 "Make Correction in in Total Children Migrated [EL107A]");    {3}
      if result=1 then
         move to EL105A;
      elseif result=2 then
         move to EL106A;
      elseif result=3 then
         reenter;
         endif; 

It is showing error [ERROR: Expecting ELSE, ELSEIF, or ENDIF near line 19 in EL107A procedure]
Please help me. Thanks
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Need Help for Validation

Post by josh »

The problem is exactly what the error message says. You need a final endif at the end to match the first if.
sah
Posts: 97
Joined: May 28th, 2015, 3:16 pm

Re: Need Help for Validation

Post by sah »

This should work:

Code: Select all

PROC EL107A
if EL106A+EL107A<>EL105A then
      numeric result=accept ("Children Staying and Migrated not matched with Total children",
                                 "Make correction in Total Children [EL105A]",                 {1}
                                 "Make Correction in in Total Children Staying [EL106A]",      {2}
                                 "Make Correction in in Total Children Migrated [EL107A]");    {3}
      if result=1 then
         move to EL105A;
      elseif result=2 then
         move to EL106A;
      elseif result=3 then
         reenter;
         endif;
   endif;
[/color]


Another way to write it as a soft check code:

Code: Select all

set behavior() specialvalues(zero) on;
if EL106A+EL107A<>EL105A then
errmsg("Children Staying( %d) and Migrated(%d) not matched with Total children (%d)",EL105A,EL106A,EL107A)
select ("Correct Total Children", EL105A, 
         "Correct Total Children Staying" EL106A, "Correct  Total Children Migrated", EL107A);
 endif;
[/color]
Socio
Posts: 48
Joined: May 1st, 2017, 4:47 am

Re: Need Help for Validation

Post by Socio »

Thank you all for the help.
Post Reply