View an external .csv file at a site of an AEM project

maxq7501091

20-07-2017

Hi,

I would have a general question of the architecture ob my AEM application.

I have to do a simple task -> show an external .csv file at a page of an AEM application - there should be no author actions or something else.

Currently I am not clear how to develop it - should I create a Component where I will load the csv over a javascript file or is it better to make an OSGi Bundle which loads the data and I access the bundle over REST- Service or ...

I would be glad for any hint in this direction.

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

zeeshank1500736

23-07-2017

No need to store this data into component as you say data is very dynamic any time can change so on component load it will fetch the .csv file directly and display it.

Using Js :You can look this url to fetch .csv and display in HTml like table from Js.

http://bl.ocks.org/ndarville/7075823 .

Using Java : From java WcmUSe class you will return map or list based on that which datastructure will fullfill your need and iterate that list or map into your component and display the data either in table format or whatever ways you want to display.

Thnaks

Answers (2)

Answers (2)

maxq7501091

22-07-2017

Thanks a lot for the answer - its really helpful, In my case this one is relevant for me:

>> If the file updated any time and many time in the day for this you have to fetch the file directly from the external TFS for this you can write java code or js for fetching and get the data and parse the .csv file  and get those data into the component UI and display it.

Therefore I will write an OSBi Bundle which reads the csv file from the external TFS.

This is no problem and easy to implement.

Actually I don't know how to store this data into the componentUI and how to display it.

From the OSGi Bundle I have to get an instance of a Component UI and set data as property of this node?

Can I do it like this. I have a missing link between OSGi Bundle and viewing this data.

Thanks a lot for help!

Max

zeeshank1500736

21-07-2017

Hi,

Every time reading the data from external file from NTFS or TFS will somehow degrade the performance.If the .csv file is not updated regularly and the file size is not huge then you can provide the option to upload the .csv file into the particular folder into DAM and then on upload write a workflow to read the file and create the node and update the node in some location and set all value of CSv in the property of nodes.For triggering the workflow you have to create workflow launcher and set the event type and path of the dam where .csv file is updated.

Read the Csv data from node and display into page for this you can create the component.

If the file updated on regular interval of time(cron job) for this you have to write Schedular that will start on the bases of cron job expression and do the same process to fetch and create or update node and read the value as same as above.

If the file updated any time and many time in the day for this you have to fetch the file directly from the external TFS for this you can write java code or js for fetching and get the data and parse the .csv file  and get those data into the component UI and display it.

Hope these information will help!

For Workflow Launcher follow this link :Workflow Launcher | Content Management

Creating Process Step in workflow follow and update this link :Adobe Experience Manager Help | Creating custom AEM workflow steps that send email messages

Example Implementation of a Workflow Process Step

Thanks