Page 1 of 2

column displays as "undefined" when the field is blank

Posted: Sat Dec 27, 2014 1:57 am
by Wai Pak

In the recent app upgrade, blank column is showing up as "undefined". Before this upgrade, blank column is showing up as blank in a query. This is more desirable to me. Is there a way to display blank if the data of a column is blank.


column displays as "undefined" when the field is blank

Posted: Sat Dec 27, 2014 3:20 am
by Ihor Didevych

Hi Wai,

Could you clarify what do you mean under column?


column displays as "undefined" when the field is blank

Posted: Sat Dec 27, 2014 6:26 am
by Wai Pak

Sorry, I really meant fields in a table of a DB.

For example, table CUSTOMER has "name", "location","yearofmember"

If I have the following data in the DB:

Wai,CA,
John,PA,1998
Mary,VA,1990

Before the upgrade, in a grid mapped to this table, I will see:

Wai,CA,
John,PA,1998
Mary,VA,1990

After the upgrade, I see:
Wai,CA,undefined
John,PA,1998
Mary,VA,1990

To me, blank on the UI is more appropriate but I would imagine some people might find undefined to be useful. I would I achieve what was there before.


column displays as "undefined" when the field is blank

Posted: Mon Dec 29, 2014 12:01 am
by Yurii Orishchuk

Hi Wai,

I tried this use case but have ""(empty) value in DB field after.

It seems you passing "undefined" value for this field

To debug it please open browser debugger on "net" tab and find your "update" service request. Then take a look on actual passed parameters.

Details: http://prntscr.com/5m1365/direct

Regards.


column displays as "undefined" when the field is blank

Posted: Mon Dec 29, 2014 2:04 am
by Wai Pak

It is not so much about me passing value. I just have a query response map to a grid. This behavior happened before few months back. Data shows as undefined in a grid when the actual DB column is null. Then, the behavior changed. Null field represented as "" in a grid and now it changed again.

You could try this: usomc.org/mobileguide, click "Find Event Information", enter "elijah pak" as the name and search. You will see that all other information are represented as blank. This app was published about a month or two back.

Then try this: http://appery.io/app/mobile-frame?src...

You will see a bunch of undefined value because they are null.

Checked the response from the debugger, what I noticed the responses were the same between the old version and new version. null value fields are not even included in the response. Therefore, it seems that some other code had changed within appery.io library.


column displays as "undefined" when the field is blank

Posted: Mon Dec 29, 2014 4:05 am
by Yurii Orishchuk

Hi Wai,

I tried your app and seems to be i can not reproduce your problem.

See details: http://prntscr.com/5m38ft/direct

Regards.


column displays as "undefined" when the field is blank

Posted: Mon Dec 29, 2014 10:50 pm
by Wai Pak

please try again. I added code in the response mapping to deal with it. I added: if(value === undefined){ return ''; }

So if you try it now, you will see the first column after the search showing up as undefined.


column displays as "undefined" when the field is blank

Posted: Tue Dec 30, 2014 1:49 am
by Yurii Orishchuk

Hi Wai,

Thanks this time i've been able to see this problem.

But take a look on the response parameters: there is no "Date"(that you link to the component in mapping) field in response.

Details: http://prntscr.com/5mgi71/direct

Please specify do you have "Date" field in the "evententry" collection?

Regards.


column displays as "undefined" when the field is blank

Posted: Tue Dec 30, 2014 5:00 pm
by Wai Pak

Date and other fields in question have been included in my query and response. However, the way the appery.io library works is that blank entry will not be included as part of the response. This behavior has not been changed. If you examined the old version of the app which was published before the appery.io library update and the new version, you will see that both responses are the same. Therefore, only the library behavior has been changed. In the old library, undefined data is represented as blank while in the new library, undefined data is represented as undefined.


column displays as "undefined" when the field is blank

Posted: Tue Dec 30, 2014 11:56 pm
by Yurii Orishchuk

Hi Wai,

It was undeclared behavior. And was changed. Currently if you have not field in your response - it will be "undefined".

Thus you need to use code to recognize it(undefined value) and return value you need(for example empty string).

Regards.