how can we create a form input element to upload CSV file and fetch that data in schema | Community
Skip to main content
rajansingh
June 14, 2023
Question

how can we create a form input element to upload CSV file and fetch that data in schema

  • June 14, 2023
  • 5 replies
  • 1840 views

I have to create a form in which I want to upload a CSV file and fetch that CSV file data in respective schema.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

ParthaSarathy
Community Advisor
Community Advisor
June 14, 2023

Hi @rajansingh ,

In general, input form is used to insert or update a single record at a time in a particular linked schema.

Instead, you can create a Workflow, create a data loading file followed by update data activity and configure all the attributes. Its a one time job to create this workflow. And later once it is build, whenever you want to insert record using CSV file, you can go to this data loading activity, upload this csv file and run the workflow. So your data in csv file will get inserted in respective schema.

 

Example, if you have a recipient data csv file, then you can create a workflow like below, and upload your csv file in the data loading.

 

Data loading:

Data loading configuration

Or you can upload your csv file in any SFTP, and collect it via file transfer activity and select 'specified in the transition'.

Update data:

Update data configuration

 

The above workflow structure is just an example. You can modify it with your use case like by adding deduplication etc.

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 5
June 14, 2023

Hi @rajansingh ,

You need to create a webapp for same.

 

n web app edit tab choose Page activity

 

In page Advanced controls -> File

 

 

Or you can change any input to file type input in "Selection controls"

 

 

 

Set up storage by choosing your context variable (you can create them here aswell)

 

 

After page JS activity has to be placed with following-ish code

 

The variable you set for the image field will contain following attributes after submit

 

 

 

<ctx>

     <vars>

          <fileImg id="0" md5="af859bcc5957fd1a60f7387d07c672ff" originalName="C:\Users\USER\Pictures\3RzNQc8Ia07A_GjjY49XOt.jpg"/>

     </vars>

</ctx>

 

 

 

so that means in JS you can distinguish from it md5 string, contentType ...

 

 

ctx.vars.fileImg -->has attributes  e.g @md5, @originalName if you want to see all of them

 

//create all fields you want to save 

 

//create xml 

var fileResXml = <fileRes contentType={contentType} 

              internalName={intName} label={originalName} md5={md5Var} 

             name={destFileName} originalName={originalName} 

             xtkschema="xtk:fileRes"><folder id={folderId}/></fileRes>; 

//create file res obj 

var fileResObj = xtk.fileRes.create(fileResXml); 

 

//publish 

fileResobj.PublishIfNeeded(); 

//save it to db 

fileResobj.save(); 

 

var fileResId = *query resource id by unique internal name*; 

 

///save resource id to linked table? 

 

fileResobj.save(); 

 

 
Level 5
June 14, 2023
isahore
Community Advisor
Community Advisor
June 19, 2023

Hi @rajansingh@aggabhi@parthasarathy@jjwatson79,

Uploading using a web app is fine. But how can that file be processed by a workflow for data import in the case where the webapp is published to the tracking server, and the upload happens on the tracking server?

Any idea about it?


Regards,

Ishan

ParthaSarathy
Community Advisor
Community Advisor
June 19, 2023

Might be  If you know the server path where the file is stored after uploading in webApp, you can create a import Workflow in Adobe campaign, fetch the file using file transfer/ file collector > data loading > Update data and update the records in destination schema. Schedule this workflow to run either every1 hour or every 30 mins.

 

Or Instead of this process, We can create the same workflow (remove file transfer/ file collector), and whenever you needs to upload a csv file and insert the records in schema, directly go to this import workflow, upload the file in data loading and start the workflow.

 

Or if the person who wants to upload the file don't have access to Adobe campaign, they can drop the file in some SFTP, and We can collect the file using file transfer activity in the same Import workflow created and import those records into the schema.

 

~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
jjwatson79
Level 2
June 15, 2023

Hi @rajansingh,

 

Please give the use case that you are trying to solve? It may be possible to use a web-app, as @aggabhi has suggested. It is an unusual way to load data. Perhaps with a clearer understanding of your use case, and WHY you need the form option, we can recommend a better approach than the one you have in mind. 

Sukrity_Wadhwa
Community Manager
Community Manager
July 13, 2023

Hi @rajansingh,

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!

Sukrity Wadhwa