Sounds simple, but little tricky
Scenario: I have two date fields (two attributes, D1 & D2). The requirement is to build a report with two prompts, one on each of the attributes. The first prompt should not have any default value and should be answered. The second one should be optional, if the second prompt is not answered, it should NOT be ignored but should take the answer from the first prompt.
I have a thought on handling this, I don’t think thats a ideal solution and would like to see if some one could propose a better solution.
My Thought: I will be creating few objects to achieve this and will name them in a simple fashion to make it easy to understand.
Create two value date prompts (V1 & V2): V1 will be a required prompt and with no default value. V2 will be optional and with a default value of “01/01/1999” (this could be any date which is not available in the warehouse and will not be available).
Create two filter objects (F1 & F2): F1 is built on D1 using V1. F2 is built on D2 using V2.
Create advanced qualification filter: Third filter (F3) is built with a apply comparison statement on D2, which says if the answer for F2 is “01/01/1999” then pick up answer from F1 else F2. Logically, if a user is not selecting an answer for F2, then the default value (of V2) will be passed and the pass through function used will force the filter on D2 to use the answer of F1.
Pass through function: ApplyComparison (“#0 in (Case when #1 = ’01/01/1999′ then #2 else #1 end) “, Date@DESC, ?[V2], ?[V1])
The only draw back I see is the display of the default date value in F2. I tried to get rid of it and could not find an easy way. I am sure some one might have a better solution.