[CSVUtil] Selected Attribute

Forge Component
(27)
Published on 2019-09-28 by Wei Zhu
27 votes
Published on 2019-09-28 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




I got the same requirement, I need to download only few columns in csv format, I tried the same rules as explained by Pedro Vila Nova, list is having all the columns,passing required columns in the config value, a blank file get created, AttrFilter is not working, can anyone please help 

Ravikumar Somachar wrote:

I got the same requirement, I need to download only few columns in csv format, I tried the same rules as explained by Pedro Vila Nova, list is having all the columns,passing required columns in the config value, a blank file get created, AttrFilter is not working, can anyone please help 


Are you sure you specify the config input parameter  when call ExportRecordList2CSV ?

If it still not work, please provide your oml.


Regards

Wei