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
Need Help for Validation
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Need Help for Validation
Dear Socio
I hope it works for you.
a.
PROC Q3A
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;
Re: Need Help for Validation
Mistake post
Last edited by Socio on October 26th, 2017, 4:09 am, edited 1 time in total.
Re: Need Help for Validation
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.
It is showing error [ERROR: Expecting ELSE, ELSEIF, or ENDIF near line 19 in EL107A procedure]
Please help me. Thanks
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
Re: Need Help for Validation
The problem is exactly what the error message says. You need a final endif at the end to match the first if.
Re: Need Help for Validation
This should work:
[/color]
Another way to write it as a soft check code:
[/color]
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;
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;
Re: Need Help for Validation
Thank you all for the help.