Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
brooksc57
Creator
Creator

Why do I have to convert date differently depending upon the User?

Hello,

I've never seen this before but ran into this interesting situation where it matters if I run script as my local desktop user or if I run it as my QV Publisher user.

The date field is stored into Sql Server as a 'date' field...so it looks like this. 2020-01-02.

What has happened (and I totally don't understand it) is that.

If I run script on desktop (server credential'd), "developer" credentials 

Date(Date#,'YYYY-MM-DD'),'M/D/YYYY') returns  1/2/2020.

If I run script on QV Publisher, but using the Publisher's credentials

Date(Date#,'YYYY-MM-DD'),'M/D/YYYY') returns    -       (a null or dash or whaterver you wanna call it).

What was happening is I built all my scripts...they run...I put them in publisher and they fail.

I then put this code in place and it works...the blurred text is my "developer" credentials.

brooksc57_0-1603291588813.png

BUT WHY???  I just don't get it.

6 Replies
Anil_Babu_Samineni

First check how OSUSER() is getting in published? Normally, Publisher holds with Internal Domain tag as well

And the other thing, is Second part of condition, Is that returning anything?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
brooksc57
Creator
Creator
Author

(D User) = Local Desktop with Server rights, OSUser()=Domain\MyUser  -  user has admin rights on the server  

(P User) = Server Desktop and Publisher,  OSUser()=Domain\ServiceUser - admin service account on the server

not sure what you mean by "is second part of condition".

When running on the Server Itself with Service User Account... (P User) as I referenced above.

returns NULL with  DATE(DATE#(InvDate,'YYYY-MM-DD'),'M/D/YYYY')

returns 1/2/2020 with DATE(InvDate,'M/D/YYYY')

When running with the (D User) as I referenced above.

returns 1/2/2020 with  DATE(DATE#(InvDate,'YYYY-MM-DD'),'M/D/YYYY')

 

 

brooksc57
Creator
Creator
Author

just realized what you were referencing, sorry.

Yes the second part of the condition returns 1/2/2020 when running it on the Service itself via QV Desktop or QV Publisher as the OSUser()=Domain\ServiceUser   account.

Anil_Babu_Samineni

Publisher has some Date format capable. But, You case is generic what I resume.

1) Check in different browsers

2) What version you are using

3) Is that IE or AJAX

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Brett_Bleess
Employee
Employee

@brooksc57 The only other thing that comes to mind is something with the service account setup on the server is looking at a different environment variable or something related to date formatting, so may want to check that out too, only thing that came to mind that might explain things, Regional Settings is what I am think of I think.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
marcus_sommer
MVP & Luminary
MVP & Luminary

Probably your app missed the various interpreting-variables which are automatically generated within the script-tab "Main" (of course they could be manually changed, out-sourced, deleted). If they don't exists Qlik takes OS settings and they might be different between your local machine and the server.

- Marcus