Forum Discussion

AndreaJohannes's avatar
AndreaJohannes
Qrew Trainee
6 years ago

Adding a conditional item to a list of missing items

Howdy,

I currently have a formula text field called "missing documents". It looks at various fields to see if there is a date in the field. If there isn't a date in the field, then it gets added to the list. Currently, all of the documents in this list are required.  I want to add a Student Driving Record document to the list - but this is only needed if yes is chosen in the StudentDriving field .  I'm not quite sure how to change the definition of the output text to say if  [StudentDriving] = "yes" AND the Student Driving Record Received is null, then  Student Driving Record.  Once I get that piece, I'm pretty sure I can figure out the rest of it.   Below is the current code in the field.  If I can figure out the optional piece of defining the output, I think I can figure out the rest of it. Thanks in advance for your help!

//First define the output text if an item is missing
var text Application=If(IsNull([Application Received]),"Application","");
var text SignedPD=If(IsNull([Signed Position Description Received]),"Signed Position Description","");
var text Training=If(IsNull(),"Training Acknowledgement","");
var text DualEmployment=If(IsNull([Dual Employment Acknowledgement Received]),"Dual Employment Acknowledgement","");
var text NewSTudentOrientation=If(IsNull([New Student Orientation Certificate Received]),"New Student Orientation Certificate","");

//Next Define if there are missing items
var bool missingItems=$Application <>"" or $SignedPD<>"" or $Training <>"" or $DualEmployment <>"" or $NewStudentOrientation <>"";

//Define an optional text value to describe what the items are that will list
var text prefix=If($missingItems=true,"Missing Items:","");

//Next list all the "missing" items in a simple-list formul
List("\n",
$Application,
$SignedPD,
$Training,
$DualEmployment,
$NewStudentOrientation
)

------------------------------
Andrea Johannes
Associate Director Business Services
Residence Life
Texas A&M University
------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    var text StudentDrivingRecord=If(([Student Driving] = "yes" and IsNull([Student Driving Record Received])),"Student Driving Record","");

    If([Student Driving] = "yes" and ([Student Driving Record Received] = "no" or [Student Driving Record Received] = ""),"Student Driving Record","");


    I think one of those are what you are looking for. I might have an extra pair of parenthesis in there but it should work as-is. The second one assumes [student driving record received] is a dropdown with yes, no, and blank.

    Also, you have a typo in NewSTudentOrientation that does not match the rest of your formula.