Solved

How would you write the following Access query statement in pseudocode - IIf([SL]="L",IIf([Direction]="Credit","D","C"),IIf(Direction="Credit","A","B")) AS T ?

Posted on 2014-01-15
7
621 Views
Last Modified: 2014-01-15
How would you read this full statement in pseudocode from an Access application?

 IIf([SL]="L",IIf([Direction]="Credit","D","C"),IIf(Direction="Credit","A","B")) AS T
0
Comment
Question by:zimmer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39782294
What do you mean by "pseudocode"? The item you've posted is "code" so I'm not sure what you need.

If you're looking for something like a "human translation", then:

Check the value of [SL].

If it the value of [SL] equals "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "D". If  it does not equal "Credit" then return a "D"

If the value of [SL] does not equal "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "A". If it does not equal "Credit" then return "B"
0
 
LVL 7

Expert Comment

by:Steve
ID: 39782337
Spot on except:


Check the value of [SL].

If it the value of [SL] equals "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "D".
 If  it does not equal "Credit" then return a

"C"


If the value of [SL] does not equal "L", then check the value of [Direction]. If the value of [Direction] equals "Credit" then return "A". If it does not equal "Credit" then return "B"
0
 
LVL 7

Expert Comment

by:Steve
ID: 39782475
Scott really should have gotten that credit, I simply pointed out a typo.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:zimmer9
ID: 39782550
How would I modify my answer.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39782644
Your statement should be:
 IIf([SL]="L",IIf([Direction]="Credit","D","C"),"B")) AS T


IF SL = "L"
      IF Direction = "Credit"
            "D"
      ELSE
            "C"
      END IF
ELSE
      "B"
END IF
0
 
LVL 37

Expert Comment

by:PatHartman
ID: 39782662
@hnasr,
Your suggestion omits one of the options.
There are two conditions, each with two outcomes so you should have four possible results.  Your recast expression has only three.

IF SL = "L"
      IF Direction = "Credit"
            "D"
      ELSE
            "C"
      END IF
ELSE 
      IF Direction = "Credit"
            "A"
      ELSE
            "B"
      END IF
END IF 

Open in new window

0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question