Marco Spera
Posts: 0
Joined: Tue Jun 17, 2014 7:14 pm

List Database

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

List Database

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...

Marco Spera
Posts: 0
Joined: Tue Jun 17, 2014 7:14 pm

List Database

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?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

List Database

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)

Marco Spera
Posts: 0
Joined: Tue Jun 17, 2014 7:14 pm

List Database

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

Marco Spera
Posts: 0
Joined: Tue Jun 17, 2014 7:14 pm

List Database

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.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

List Database

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...

Marco Spera
Posts: 0
Joined: Tue Jun 17, 2014 7:14 pm

List Database

I will try this out, Thanks!

Return to “Issues”