Support » Plugins and Hacks » Adding Rows into a Repeater Programatically (CSV of Data)

Adding Rows into a Repeater Programatically (CSV of Data)

  • As a note, I am just bulk importing into a single post.

    I currently have a CSV with over 500 values. I want to add a bunch of new rows with the data, and was wondering if there’s a way to programmatically be able to do this?

    I created a Java program to handle the creation of code I need. See below.

    Here’s my code:


    public static void main(String[] args) throws FileNotFoundException, IOException {
            CSVReader reader = new CSVReader(new FileReader("data.csv"));
            String [] nextLine;
            int count = 0;
            while ((nextLine = reader.readNext()) != null) {
                // nextLine[] is an array of values from the line
                Handler data = new Handler(nextLine, count);
                appendToFile(data, "results.txt");  // append data to end of a text file


    Private String lat, long;
    Private int count;
    public Handler(String[] line, int count) {
    	this.count = count;
    	if (line != null) {
    		for (int i = 0; i < line.length; i++) {
    			if (line[i] != null) {
    				switch(i) {
    					case 1: this.lat = line[0]; break;
    					case 2: this.long = line[1]; break;
    					default: break;
    			} else {
    				line[i] = "";
    Public String toString() {
    	String repeater = "latlng_repeater"; //repeater field name
    	String value_lat = "latlng_repeater_item_lat"; // sub field name
    	String value_long = "latlng_repeater_item_long"; // sub field name
    	String repeater_field_key = "field_53cf18c22ee37; // repeater field key
    	String value_lat_field_key = "field_53cf19022ee3b"; // lat field key
    	String value_lat_field_key = "field_53d09ad6527ac"; // long field key
    	String post_id = "248";
    	String result = ""; // create code for insertion
    	return result;


  • The topic ‘Adding Rows into a Repeater Programatically (CSV of Data)’ is closed to new replies.