Strange IF

jiju

Active Member
Hi All,
Is there any limitations on the number of nested ifs in JDE...Since i am getting ERRORs for the 35 nested ifs that i am using in one of the applications.

Thanx & Regards
Jiju
 
Why are you using 35 nested if's? There might be a more efficient way to implement your solution.
 
Sounds like it is time to rewrite/break-up your logic a bit. Assuming you are on Xe, nesting an IF statement beyond 8 or 9 times becomes unreadable simply because the NER doesn't indent. You end up with a wall of statements that becomes a maintenance nightmare. If you have to, try to put some logic into business functions to break it up.
 
Try using a select instead of IF.
Or call a process.
There is always an easier way to do things than 35 nested
IFs.
This is from someone who has been writting C/C++/C# code for
ages.


Here are some solutions you maybe able to try
IF ((condition == condition2
&& x != y
&& !VALUE)
|| (condition != condition2
&& x== y)
{
code here
}
elseif (if with and/or here
{
code here
}
else
{
code here
}

If you want help post me what you are doing and the
35 IFs and we can help you break them out. Into more
managable code.

Oh and the select restriction for a single value.
Here is how i often get arround it.
On the when statement call a predefined #define
#define (a, b) str_cmp(a,b)
would return TRUE or a 1 if this is
 
Back
Top