28 Replies Latest reply: Jul 28, 2017 9:59 AM by sony sing

# current day logic

Hi all,

Antonio Mancini

I have a scenario like below  attached with sample data and with example.

and how can set the day of the week  ?  how to this in scripting?  and in  front end how to approach?

Thanks

Sonica

• ###### Re: current day logic

Hi,

Use the below expression..

=if(match(num(weekday(Today(1))),1,2,3,7), if([timeduration(in days)]>5, 'More Than 5 Days'),

if(match(num(weekday(Today(1))),4,5), if([timeduration(in days)]>3, 'More Than 3 Days'),

if(match(num(weekday(Today(1))),6), if([timeduration(in days)]=4, '4 Days or More'))

)

)

• ###### Re: current day logic

thanks but If I want to create it backend how to create?

• ###### Re: current day logic

your expression is working but it is showing all more than 3days even though there is less than 3days duration values also.

• ###### Re: current day logic

Hi Sony,

if Today() =6 then DaysDuration >= 4  or <=4?

If(Match(Num(WeekDay(Today()))+1,1,2,3,7),Only({<DaysDuration={'>5'}>} DaysDuration),
If(Match(Num(WeekDay(Today()))+1,4,5),Only({<DaysDuration={4,5}>} DaysDuration),
Only({<DaysDuration={'<=4'}>} DaysDuration)))

• ###### Re: current day logic

thanks for quick response  prashanth and Antonio.

Give me some time I  will check and come back to this logic

• ###### Re: current day logic

Also attached the sample app with your data

• ###### Re: current day logic

hi Sir,

if Today() =6 then DaysDuration >= 4  or <=4?

logic :for this ----> if day is 6   and duration  =4 and >4

and how to set the weekday in script?  how to use variable to set that?

• ###### Re: current day logic

In Script

LET vDay = Num(WeekDay(Today()))+1;

Expression :

If(Match(vDay,1,2,3,7),Only({<DaysDuration={'>5'}>} DaysDuration),
If(Match(vDay,4,5),Only({<DaysDuration={4,5}>} DaysDuration),
Only({<DaysDuration={'>=4'}>} DaysDuration)))

• ###### Re: current day logic

in my data it is not working sir,

in my data duration column coming as seconds so I  converted like below

but  I added the data through inline  like  63200   less than 10 days  but that expression is not giving the result.

and btw  what it will give the result can you explain?

LET vDay = Num(WeekDay(Today()))+1;

• ###### Re: current day logic

See Attachment

• ###### Re: current day logic

Hi,

LET vDay = Num(WeekDay(Today()))+1;

this variable displys today+1  y this?  why cant we use only today? any specific reason?

• ###### Re: current day logic

Because QV Logic is Mon -> 0 and Your Logic is Mon -> 1

• ###### Re: current day logic

thanks  for clarification. how can I include this in below expression

),

"  only(if(isnull(Assignedto), Number))"    this also part the of expression.

I want the above criteria along with the field assignedto value is null.

• ###### Re: current day logic

I'm sorry, I don't understand. What is Your new logic ?

• ###### Re: current day logic

the logic is the report is like to display the numbers where the filed assignedto is null along with the  day logic criteria

• ###### Re: current day logic

You mean, that expression/calculation should execute if the assignedto value is null??

• ###### Re: current day logic

yes exactly

• ###### Re: current day logic

If so, use one more condition like len(trim(assignedto))=0 along with days condition or you can use...

if(len(trim(assignedto))=0, 'Expression i.e. the one which used for days')

• ###### Re: current day logic

If(IsNull(Assignedto),YourExpression)

or If(Len(Trim(AssignedTo))=0,YourExpression)

However, can You provide new Input Data ? (modified Excel File)

• ###### Re: current day logic

Hi Sir,

attached updated excel with new column assigned to --- display above criteria where assignedto value is null only/

• ###### Re: current day logic

#### now( [ timer_mode] )  ---- timer_mode: 0, 1, 2, default

Returns a timestamp of the current time from the system clock. The timer_mode may have the following values:

0 Time at script run
1 Time at function call
2 Time when the document was opened

Default timer_mode is 1. The timer_mode = 1 should be used with caution, since it polls the operating system every second and hence could slow down the system.

#### today( [timer_mode] ) ---- timer_mode: 0, 1, 2, default

Returns the current date from the system clock. The timer_mode may have the following values:

0 Date at script run
1 Date at function call
2 Date when the document was opened

Default timer_mode is 2. The timer_mode = 1 should be used with caution, since it polls the operating system every second and hence could slow down the system.

So now(), now(1) and today(1) all refresh every second, and should be used with caution.

• ###### Re: current day logic

New Attachment

• ###### Re: current day logic

Hi Sir,

Could you check is this logic will work for my requirement?   or will I do any changes?

• ###### Re: current day logic

This is different logic.

It seems same result.

I don't see IsNull(assignedto)

• ###### Re: current day logic

Hi,

Now check the app with correct result . which is working fine.     [forgt null I worked in real app null is also working]

for your testing just change in inline

currentday,limit

1,5

2,5

3,5

4,3

5,5   ----- this

6,4

7,5

];

• ###### Re: current day logic

the above both expressions are not giving any result

• ###### Re: current day logic

and the expression if write like below its working but if I write total condition its not working'