By Norske on Monday, 03 August 2015
Posted in Technical Issues
Replies 7
Likes 0
Views 492
Votes 0
Some of the address, city, state, zip records in the social_fields_data for my users has the correct value in the datakey field. The datakey field holds values for them like "address1", "city", "state", "zip", etc.
However other users in this table have no datakey value in the address records.
In addition the field_id values are also different between these two sets of records.

What should I do? I have having trouble creating custom membership reports because I can't reliably extract address data. In addition, I use the Appcarvers mobile app and it can't display address data in user profiles as well.

Is there harm in manually updating the datakey and field id to be consistent on all records?

I would upload screenshots to explain, but I don't see a way to make this forum post private just for stackideas Support team.

Thanks
Hello Norske,

If the field_id is different means it is not the address custom field and you cannot manually update the datakey column. For example my Address field ID is 134, all the data of that ID will have 134 as a field ID even if the data column is empty. By the way, you can send the screenshot in the Optional Information field in the Site Details section below the reply form. Only Stackideas' support team will be able to view it.
·
Monday, 03 August 2015 12:12
·
0 Likes
·
0 Votes
·
0 Comments
·
OK, didn't know about the attachments being private. Here they are.
What should I do? Should I change the field ID of the bad records via SQL?
·
Monday, 03 August 2015 19:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Norske,

Some of these data could be added since 1.1.x or 1.2.x, and their datakey could be different but it's best that you run the SQL query below to get an idea of which app element and which profile type the field data is being associated to:


select a.*, e.element, d.title from jos_social_fields_data as a
inner join jos_social_fields as b
on a.field_id = b.id
inner join jos_social_fields_steps as c
on b.step_id = c.id
inner join jos_social_profiles as d
on c.uid = d.id and c.`type` = 'profiles'
inner join jos_social_apps as e
on b.app_id = e.id;
·
Monday, 03 August 2015 22:40
·
0 Likes
·
0 Votes
·
0 Comments
·
OK, the result of the SQL query is attached (change to .csv extension). How should I use this? Can you give an example?
·
Tuesday, 04 August 2015 04:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Norske,

I am not entirely sure what you are trying to achieve here. The problem is that there's no way to really know which types of data is used as the datakey. The best way I would think is to request your users to edit the profile and save it again.
·
Tuesday, 04 August 2015 22:39
·
0 Likes
·
0 Votes
·
0 Comments
·
I was trying to achieve a SQL query that returned a username, first and last name, address, city, state, zip for a report on the site.
With address showing up in multiple fields I couldn't figure out how to create a query.
You are right that saving the record updated the field the address was stored in. I think I can make that work.
·
Thursday, 06 August 2015 11:07
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Norske,

I am sorry for the delay of this reply.

Regarding the datakey for address field, by right when you upgraded your EasySocial to version 1.3, there is a maintenance script to convert the address data into multiple row format. Can you try re-run the maintenance script again? Go to your EasySocial backend under Maintenance -> Scripts and execute the script name 'Update address field data to multirow'. You should be able to find this script by filter with version 1.3.0. Please see: http://screencast.com/t/YwDa92uk

Please note: before you perform the above step, please backup your database first incase something unexpected happen, you still have the chance to revert back your database to initial state.

If running the maintenance scripts doesn't convert the address into multiple rows, then the only way to fix this is to request your users to re-save the address from their profile edit page.

Now, your user's address data should be in multiple row format. You can then retrieve these data based on the datakey. E.g.


select a.id, a.username,
(select d1.`data` from jos_social_fields_data as d1 where d1.uid = a.id and d1.type = 'user' and d1.datakey = 'first' limit 1) as `firstname`,
(select d2.`data` from jos_social_fields_data as d2 where d2.uid = a.id and d2.type = 'user' and d2.datakey = 'last' limit 1) as `lastname`,
(select d3.`data` from jos_social_fields_data as d3 where d3.uid = a.id and d3.type = 'user' and d3.datakey = 'address' limit 1) as `fulladdress`,
(select d4.`data` from jos_social_fields_data as d4 where d4.uid = a.id and d4.type = 'user' and d4.datakey = 'city' limit 1) as `city`,
(select d5.`data` from jos_social_fields_data as d5 where d5.uid = a.id and d5.type = 'user' and d5.datakey = 'state' limit 1) as `state`,
(select d6.`data` from jos_social_fields_data as d6 where d6.uid = a.id and d6.type = 'user' and d6.datakey = 'zip' limit 1) as `zipcode`
from jos_users as a
limit 10
;


Hope this help and have a nice day!
Sam
·
Thursday, 06 August 2015 12:06
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post