Changing screen contents based on Date

I have a mobile app screen that is required to show a different image based on the date. Eg, 1st Jan the screen shows the image for 1st Jan. 2nd Jan, the screen shows the image for the second. How do I go about doing this ?

Hi Tudyisster Siva,

Fellow below steps.

1. Create Folder structure and store your images.

    Jan/01/image.jpg

    Jan/02/image.jpg

   ..etc

2. In Preparation get month and date separately ( This URL will help you to get month and day from datetime )

3. In Preparation use assignment and prepare directory based on month and day

    "/Images/"+Month+"/"+Day

4. Use the same variable in Web screen to render image.


Hope this helps.


Sravan

Sravan Vanteru wrote:

Hi Tudyisster Siva,

Fellow below steps.

1. Create Folder structure and store your images.

    Jan/01/image.jpg

    Jan/02/image.jpg

   ..etc

2. In Preparation get month and date separately ( This URL will help you to get month and day from datetime )

3. In Preparation use assignment and prepare directory based on month and day

    "/Images/"+Month+"/"+Day

4. Use the same variable in Web screen to render image.


Hope this helps.


Sravan


Hi Sravan

Is this only for web apps ? Or can this be done for mobile applications as well ?

It will work perfectly for both mobile and Web.


Sravan

Apart from Sravan's solution, you can also store the images in the database, and associate them with a date, but this will require a bit more work. The upside is that it's more flexible, allowing you to change the images without publishing a new version of the Module.

Kilian Hekhuis wrote:

Apart from Sravan's solution, you can also store the images in the database, and associate them with a date, but this will require a bit more work. The upside is that it's more flexible, allowing you to change the images without publishing a new version of the Module.


Hi !

Id like to try your method out, how would I go about associating an image in the database with a date ? 

Thanks !

Hi Tudyisster,

To store images in the database, especially with the goal to have them configurable, you will need to create a backoffice screen for managing the images. This is not that hard, and involves setting up a data model (with at least two Entities: one containing meta data like some kind of identifying code (you could use a seperate Static Entity if you have a limited set, and reference that) and the date (or date range) you want to use the image on, and one Entity containing as Id the first Entity's Id, and a Binary Data Attribute for the Image, something like this:

You'll also need a list Screen for displaying the currently present images and a detail Screen for editing or creating a new one. The detail Screen will allow uploading of the image using the Upload Widget.

To use such an image on the screen, set the Image Widget's Type Property to Database, set the Attribute to the binary content ("DynamicImageBinary.ImageBinary" in the example above), and the Entity Identifier to a local identifier that you are setting e.g. in the Preperation to the right image based on the current date.