Submitted by viking on 2022/01/24 01:21

I have a text Field "KnownDueDate" with a popup list "Known" &  "Unknown".
If I select "Unknown" I want the DueDate to be blank. If I select "Known", I do not want the DueDate to change.

I tried various auto-assignment rules but I can't get it to work properly.
Any suggestions..?
   
 

 

Comments

It doesn't matter if it is a Yes/No Field or a Know/Unknown Field.

My problem is to get the auto-asssign of the DueDate Field to work properly.

I tried something like this:
   AME:[DueDate]=iif([KnownDueDate]="Unknown","",[DueDate])

However, there are two problems with this:
1. How do I set the DueDate Field blank? I tried "", 0, and null. Neither seems to work.

2. I am not sure if I can use the iff function because DueDate is set to the third argument ([DueDate]) if false. Ideally, I don't want DueDate to change if it is false, but maybe [DueDate]=[DueDate] would work?
 

 

Hi viking,

VBScript is very simple to use and can easily replace iif clauses

(FYI: the iif clause you use is actually a system user function -- see the Visual Basic editor)

[edit]

So something like (not tested):

public function TextDate(sText, DueDate)

  dim d

  if sText = "Unknown" then

    d=Null

  else

    if isDate(sText) = True then

      d=cDate(sText)

    else

      d=DueDate

    end if

  end if

  TextDate=d

End Function

 

Then in the Auto-Assign of your text field, set AM: [DueDate] = TextDate([KnownDueDate], [DueDate])

How do I ?