Page 2 of 2

List Database

Posted: Fri Jun 27, 2014 7:31 pm
by Marco Spera

Would it then possible to map a different field from a database based on the current date?

I have a database that lists:

Week1
Week2
Week3
etc

And would like to list the appropriate list, based on the which week of the year this is.

I am assuming I can just write a javascript to calculate the date and there know which field from the database to pull.

But how do I map this, and where would I put the appropriate javascript.

Also, which javascript function can obtain the value from the database, so that I can assign it to a variable?

Thanks


List Database

Posted: Fri Jun 27, 2014 7:47 pm
by Evgene Karachevtsev

Marco,

You should use Date queries to the database
http://devcenter.appery.io/documentat...
to get entries of required dates only.
Add js in parameter where of the query parameter to dB http://devcenter.appery.io/documentat...


List Database

Posted: Fri Jun 27, 2014 7:58 pm
by Marco Spera

I am assuming that is if they are different Entries under the same column heading.

I am talking about mapping a different column heading based on the date.

Would this same process you mention still apply, if my data in my database is under different column headings for each?


List Database

Posted: Fri Jun 27, 2014 9:00 pm
by Evgene Karachevtsev

Marco,

You should add js in mapping of the entire row of collection (from $ to the table or to component that you use) and in js you should check all the required data, and via js add the value of the needed field line in the target component.
Or you can add several elements and make the mapping of all the possible fields to the appropriate elements. And also add the mapping to the field visible of each of these components. in the mapping in the field visible add js to check whether the element is visible or not (return from the js code true or false)


List Database

Posted: Mon Jun 30, 2014 5:49 pm
by Marco Spera

Hi,

I am sorry but I do not quite follow exactly your suggestion. would you be able to explain more specifically using the following screenshots?

Thanks in advance!

Image Image


List Database

Posted: Mon Jun 30, 2014 5:51 pm
by Marco Spera

I am trying to have the field Week1 mapped to mobilelist_85 (pick) during say the first week of september. Then once the second week of september arrives, I would like the field Week2 mapped to that same mobilelist_85 (pick), instead of Week1. and to continue in this fashion for each week.


List Database

Posted: Wed Jul 02, 2014 6:35 am
by Evgene Karachevtsev

Hello Marco,

1) remove the mapping from $[]-Week1 to Peek-Text
2) in mapping from $[] to Peek add this JS code

codevar week = /get week number someway/;
$(element).text(value["Week"+week]); /code

to get week number please look here: http://stackoverflow.com/questions/61...


List Database

Posted: Wed Jul 02, 2014 3:42 pm
by Marco Spera

I will try this out, Thanks!