Date Format and Lookup keys Version 2 not working


#1

Hi Guys

I am looking for the abilty to return datetime field as d/m/yyyy but can’t find the file which allows you to change this in version 2.0 , I made a change in the df.php restarted servers but no effect.

Also i used user lookup keys in vserion 1.9, but it does not appear to be working in version 2.0
It is not replacing it with a value. eg. IDX RESSOURCE = 100 I use {IDX RESSOURCE} in the query which should have a value of 100, but all it does is this {IDX RESSOURCE} , which you then get an sql error nvarchar to int error.

Thanks
Tony


#2

Tony, I’m checking on the date format item.

As far as lookup keys go, I’m not having any trouble using them. Can you tell me more precisely how you’re including the lookup in your API call?


#3

Hi this is using the APIDOCS
In the filter field i have IDX_RESSOURCE= {EMPNUM}
looks like this from the APIDOCS

http://45.35.50.168:8080/api/v2/UKScheduler/_table/UKPlanner.vw_myobtasksforalerts?filter=IDX_RESSOURCE%3D%20{EMPNUM}&limit=10

I have set up a Global lookup key as EMPNUM set that to 100 and made it private… I get the following error

{
“error”: {
“context”: null,
“message”: “Field ‘IDX_RESSOURCE’ must be a valid integer.”,
“code”: 400,
“trace”: [
“0 C:\Bitnami\dreamfactory-2.0.1-0\apps\dreamfactory\htdocs\vendor\dreamfactory\df-sqldb\src\Resources\Table.php(599): DreamFactory\Core\SqlDb\Resources\Table->parseFilterValue(’{EMPNUM}’, Object(DreamFactory\Core\Database\Mssql\ColumnSchema), Array)”,


#4

I believe lookups are stored as strings, so if your database is expecting an int there will likely be type mismatch issue.


#5

Hi Drew

But it should replace the {EMPNUM} with a value anyway which in my case is 100 , it does appear to be doing that. How would i convert it to an INT ?

Thanks
Tony


#6

Hi Drew
I think this may be a bug , I found the problem
If you add a Global Lookup Key but do not set it to private is works eg. EMPNO key set to value 100,
If you then change the same key to private I get the error ’ must be a valid integer.

The private key setting is not working properly for int values.

Can you let me know what the fix is ?
Also That the problem with the date format and how can i set for the format.

Thanks
Tony


#7

Hi guys - happy 2016 - hope it’s a good one. I’m having something similar here on my side, but it seems to be related to including multiple conditions in the filter.

My data has an fk_companyID and column called d. When I filter (using DF API Explorer) with just fk_companyID=2 works like a charm, but the moment I say fk_companyID=2 OR d=3 it gives me the same error, says fk_companyID must be a valid integer… Any ideas @drewpearce


#8

Hey guys. Sorry for the delay on getting back.
Date formatting can be set in the .env file.

Martin, make sure you’re on the latest version of dreamfactory (currently 2.0.3) and try putting parentheses around your filter conditions
e.g. (a=1) OR (b=2)
We recently fixed several bugs in filter processing.


#9

Hi thanks @drewpearce - I was just wanting to post that now as well, was my last troubleshooting attempt and it worked. Have a good one! Upgrading my app to work 2.03 and this is part of the upgrade work.