Preloading data where the primary key is a combination of 2 or more columns in a CSV

Hi Everyone,

I am using the pulldata() function to preload data from a CSV. I
understand that it requires a primary key column to identify the correct
row to preload.

Is it possible to combine 2 or more columns, whose combination creates a
primary key, and preload a row of data? Something like this condition where
the combination of cityid and districtid creates a primary key:
pulldata('hhplotdata', 'city', 'city_key', ${cityid}) and
pulldata('hhplotdata', 'district', 'district_key', ${districtid})

Thanks in advance.

Hi Sanjeev,

You would need to combine the columns into a composite column in the .csv
itself, then use that composite in your pulldata() call. In your form, you
can use the concat() function to combine fields together, as in:

concat(${districtid}, '-', ${cityid})

In Excel, it would be something like this to create the composite column in
your source file:

=A2 & "-" & B2

Best,

Chris

ยทยทยท On Mon, Feb 1, 2016 at 12:50 AM Sanjeev Swamy wrote:

Hi Everyone,

I am using the pulldata() function to preload data from a CSV. I
understand that it requires a primary key column to identify the correct
row to preload.

Is it possible to combine 2 or more columns, whose combination creates a
primary key, and preload a row of data? Something like this condition where
the combination of cityid and districtid creates a primary key:
pulldata('hhplotdata', 'city', 'city_key', ${cityid}) and
pulldata('hhplotdata', 'district', 'district_key', ${districtid})

Thanks in advance.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.