[CSVUtil] Selected Attribute

Forge Component
(22)
Published on 2017-10-09 by Wei Zhu
22 votes
Published on 2017-10-09 by Wei Zhu

Need some help. Im trying to load data from csv to insert it to system database. The problem is not all field is mandatory, so some field can be left empty. So here is my question :
1. How to load only selected attribute?
2. What is AttrFilter function?
3. How to use it (AttrFilter)?

Abdiel Alvin wrote:

Need some help. Im trying to load data from csv to insert it to system database. The problem is not all field is mandatory, so some field can be left empty. So here is my question :
1. How to load only selected attribute?
2. What is AttrFilter function?
3. How to use it (AttrFilter)?

HI Abdiel Alvin,

1 - What do you mean with "only selected attribute"? 

you can load only a this attribute


2 - Attributes that need to be loaded


3 -  Just assing the AttrFilter   to CsvLoadConfig.CSVLoadConfig.AttrFilter

Pedro Vila Nova wrote:

Abdiel Alvin wrote:

Need some help. Im trying to load data from csv to insert it to system database. The problem is not all field is mandatory, so some field can be left empty. So here is my question :
1. How to load only selected attribute?
2. What is AttrFilter function?
3. How to use it (AttrFilter)?

HI Abdiel Alvin,

1 - What do you mean with "only selected attribute"? 

you can load only a this attribute


2 - Attributes that need to be loaded


3 -  Just assing the AttrFilter   to CsvLoadConfig.CSVLoadConfig.AttrFilter

Thanks for your reply

1. Thats exactly what I mean

3. Did you have any example how to do that? Like, I have 5 column, A, B, C, D, and E. But I only want to insert value on column A and C


HI Abdiel Alvin,


AttrFilter is implemented for following scenario

- Export Selected Attributes of List to CSV

  Your list had 5 columns, and you want to export only A and C to CSV.

  At that case, you can set AttrFilter in CSVExportConfig  to "A,C".

- Load CSV to Selected Attributes of List

  Your list had 5 columns, and your CSV had only A and C.

  At that case, you can set AttrFilter in CSVLoadConfig to "A,C", the result is A and C will be filled and other Attributes are empty.


If you open the CSVUtilSample, there are input for AttrFilter and you can try it.


Regards

Wei