Results 1 to 9 of 9

Thread: IF / ELSE Rules

  1. #1
    johnnypict is offline Member
    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Default IF / ELSE Rules

    First I'm not writing code ...but I hope someone can help me with IF / ELSE / AND / OR rules if possible.

    I am doing a piece of work/analysis where I have to put [TAGS] in letters based on the scenario we send to an applicant who wants a sports award, (financial).
    This will go to a java developer to build.
    I haven't a great deal of experience.
    The letter text sent will depend on the rule …

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    So we have a rule that says you don’t need to do anything (we’ll assume no changes). See [ELSE] at bottom.
    <<Basically this is if your salary falls between a particular band say 10k to 20k and you have a dependent child that we have proof for>> BUT …

    [IF SALARY.ASSESSED is BAND B]
    <<where salary assessed is the entity and BAND B (20k to 30k) is the attribute.>>

    Send TEXT A or B in letter

    Where TEXT A = [DEPENDENT.ASSESSED = 16 – 20]
    The actual text is something like: You have a dependent who has turned 16 and are no longer an eligible dependent so send us proof of this dependency being extended (to <21 Yrs) or details of a new dependent <16 OR >16 and <21.
    [OR]
    Where TEXT B =
    You have a dependent who turned 21 yrs and is no longer an eligible dependent so send us proof of a new dependent <16 OR >16 and <21.
    Some static text goes here…
    [ELSE]
    SIGN THE DOC TO CONFIRM NO CHANGES
    [ENDIF]

    I’ll have a stab at it but can someone confirm if this code/tag works…
    You don’t need to do anything to get award
    [IF SALARY.ASSESSED = BAND B]
    [AND]
    [DEPENDENT.ASSESSED = 16 – 20]
    Text A here.
    [OR]
    [DEPENDENT.ASSESSED = 21 +]
    Text B here.
    [ELSE]
    SIGN THE DOC TO CONFIRM NO CHANGES
    [ENDIF]
    Some static text goes here…

    Thanks for any help. I appreciate any feedback.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,041
    Rep Power
    10

    Default Re: IF / ELSE Rules

    You're going to have to write code that tests your assumptions. No way around it. We aren't going to write code for you, run it for you, and report back our findings. If you want to see if your code works, then you're going to have to run it.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    johnnypict is offline Member
    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Default Re: IF / ELSE Rules

    Sorry I've no experience of coding as that's not what I do. I've been fortunate or unfortunate enough to have a piece of work where letter tags issue particular text.

    I was trying to see if what I thought made sense.

    Sorry for wasting your time :)

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: IF / ELSE Rules

    That [OR] should be an [ELSE IF] since it involves doing something.
    The structure is:
    Java Code:
    IF x
        do something
    ELSE IF y
        do something else
    ELSE
        do yet a different thing
    where 'x' and 'y' are boolean expressions involving AND and OR.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    johnnypict is offline Member
    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Default Re: IF / ELSE Rules

    Ah cool Tolls.
    Thanks for that it think it makes sense to me now.

    So the 'AND' is correct and it should be ...

    [IF SALARY.ASSESSED = BAND B]
    [AND]
    [DEPENDENT.ASSESSED = 16 – 20]
    Text A here. This text will be sent!
    [ELSE IF]
    [DEPENDENT.ASSESSED = 21 +]
    Text B here. This text will be sent!
    [ELSE]
    SIGN THE DOC TO CONFIRM NO CHANGES
    [ENDIF]
    Some static text goes here…

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: IF / ELSE Rules

    I suspect the else-if should have an AND for the salary.assessed, otherwise that implies Text B will go out for anyone with a Dependent 21+?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    johnnypict is offline Member
    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Default Re: IF / ELSE Rules

    So...we only want to send either

    A - your salary is x so send info because you have dependent who is (turned) 16 - so no longer a dependent.
    OR
    B - you salary is x so send info because you have a dependent who is (turned) 21 - so no longer a dependent.
    OR
    C - sign the doc and return

    So if we add an AND do you mean where I have it below?

    [IF SALARY.ASSESSED = BAND B]

    [AND]
    [DEPENDENT.ASSESSED = 16 – 20]
    Text A here. This text will be sent!

    [AND] (put 'AND' here?)

    [ELSE IF]
    [DEPENDENT.ASSESSED = 21 +]
    Text B here. This text will be sent!
    [ELSE]
    SIGN THE DOC TO CONFIRM NO CHANGES
    [ENDIF]
    Some static text goes here…

    Thanks. J

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: IF / ELSE Rules

    The ELSE IF is just a normal if statement.
    Exactly the same as the first IF, but with a dependent 21+.
    Remember my structure above, there are no ANDs or ORs except in the 'x' and 'y' expressions.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    johnnypict is offline Member
    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Default Re: IF / ELSE Rules

    Yes think I'e got that now.
    Thanks for your help Tolls :)
    J

Similar Threads

  1. Architecture Rules 2.1.1
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-11-2008, 03:39 PM
  2. Architecture Rules 2.1.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-05-2008, 07:18 PM
  3. Replies: 1
    Last Post: 07-05-2008, 04:08 PM
  4. Architecture Rules 2.0.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-17-2007, 03:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •