String Combine not saving in database
-
Good day Roland
I seem to be having trouble with a record saving a string comnbine value. Sometimes it saves, sometimes it doesn’t, sometimes it’s partial.
When it is used for display purposes it will display as desired, regardless of if it is saved to the database or not.
When used for search purposes and pdb-vounteer-dropdown php, the records not saved to the database are not returned as an option. In the cases where only one of the two values are saved, that single value is returned as an option.I did read a similar topic where you suggested possibly too many fields in a field group. This particular field group has 14 fields. I will try that as a remedy however, do you know if there is anything I can do to ensure the string combine is saved correctly each time?
Cheers
-
https://drive.google.com/file/d/1gDPmMUq0iF9iwEj18WhLVlYBtIIRM-U5/view?usp=sharing
Display Content:In the above example, Kuia Little Lady and Kuia Mama Bear have not been saved as a string combine in the database however they are displaying perfectly fine in the pdb_list_user shortcode.
When we check the database, we can there is a null value in the string combine field.
https://drive.google.com/file/d/1py41pNMAaOw-oUzXgTI99enhK2CEJMeL/view?usp=sharingYou can also see that Kaumatua Papa Bear has been saved correctly as a string combine.
I hope this gives you a clearer picture
Reducing the number of fields in the field group to two, resulted in no changes.
Sorry this wasn’t added to the previous message.
This is the dropdown for our search criteria. As you can see, Kaumatua Papa Bear is showing up but not Kuia Mama Bear and Kuia Little Lady.
https://drive.google.com/file/d/1Y67aUEhzxVeop8B273bfyXGL75EMzG3P/view?usp=sharing
After trialing different structures I have noticed that:
If the string combine element is added to the signup shortcode, an empty string is saved. If the string combine element is not added to the signup shortcode, a NULL string is saved. I will be keeping the element in the sign shortcode from now on.
I have also found something that maybe a cause of the issue and you might be able to confirm if this might be the problem.
I am using a string combine within a string combine.
Example:
String Combine 1
Full Name = [first_name] [last_name]String Combine 2
Full Title = [Title] [Full_Name]I’m not sure if this causes any conflicts however, as mentioned above, sometimes the record saves and sometimes it does not.
Thanks
Part I
I have eliminated the string within a string element and broken it down in to their individual components and that seems to help a lot.
Instead of:
Full Title = [Title] [Full_Name]
I used:
Full Title = [Title] [first_name] [last_name]After this change I had some success. I kept the string combine element within the signup shortcode and my first new signup fixed all the previous records and filled in correctly all the records that were previously empty or null, but it saved the newly recorded signup as empty.
I entered another new signup thinking it would fill in the previous records empty field but after saving it, both the newly recorded signup and the previous signup were empty.
If you are able to suggest what I might be doing wrong or if there is anything different that can be done, it would certainly saved me a lot of time having to make the changes manually in phpmyadmin.
Please forgive the continued messaging. I’m trying to give as much information as possible. Still trying different setups.
Thanks again
No Luck.
Previous five sign ups returned empty strings in the string combine field.
I tried positioning the string combine field in various positions in the “fields” attribute of the pdb_signup shortcode.
I tried delaying the “Save” button for a minute to see if this will allow for any processing time, no luck.
I tried attempting to edit the record on a pdb_record page but the string combine field is obviously uneditable.I’m actually having problems with most of my string combine fields saving to the database, (no problems displaying them, but problems searching for them), but if I could sort this one out, maybe it will give me the pattern for how to fix the others.
I am at a loss unless you’re able to suggest a remedy.
Thanks Roland.
Well, I’ve given this some testing and I’m unable to duplicate the problems you’re seeing…I may be missing something that is different on your setup. However, if you enable plugin debugging and use the debugging log, you should be able to see when the record is updated or created what the exact database query is and if there is a problem with it.
When a string combine field is searched, the search looks for a value in the database. The field only saves to the database when the record is saved or created, so taking a look at the database may be helpful.
One thing you can do to force all the string combine fields to regenerate and save the combined string is to change the template setting of the field. Check the database after doing this to see if all the fields were saved.
-
This reply was modified 4 years, 7 months ago by
xnau webdesign.
That worked.
I removed the string combine field from the pdb_signup page, then
I changed the value in the Manage Database Fields of the selected string combine element
Full Title = [title] [first_name] [last_name]
and gave it a totally different value:
Full Title = [random_field_1] [random_field_2]
and saved the changes. Then reverted the desired value again:
Full Title = [title] [first_name] [last_name]
and save the changes a second time.
I replaced the string combine field back into the signup page then added a new participant. Checked the database and hey presto, the changes were successful.
Your help and support is tremendous and once this database/website is done, we will definitely be making a contribution to the tip jar.
Sincerely
Phillip and the teamSorry Roland, I misread my database.
What happened was the first record had their string combine field updated with the correct values, (that’s why I thought it had worked because I saw data in place where there normally isn’t data), and the newest record contained null values again.
Do you know if having multiple string combine fields in the signup shortcode causes conflict between the fields?
Still trying to work this one out.
Cheers
Really weird.
I kept adding participants and kept returning null values. I tried the template reset again and what happened was that, all the previous empty values were filled out correctly but the newly added participant returned an empty string.
So as long as I keep adding participants without resetting the template, I will be getting an empty string for every new record. As soon I reset the template then add a new participant, all previous records will be corrected.
It’s not the perfect solution but at least I know now that this way is usable to save from doing every single record manually.
I realise you may have reached your problem solving solutions but if you happen to have an epiphany, I would be more than glad to hear from you.
Thank you for your support
I have 31 field groups, average of 7-8 fields per group, biggest field group = 19, second biggest field group = 15.
Just for your information
I’ll turn debugger on and let you know if that produces any results.
Cheers
I don’t know what’s going on Roland haha…
Turned on debugging.
Added 2 new participants.
Checked database, empty returns
Checked the log, empty string saved to string combine field
Reset the templates as above to test for next participant addtion
At the completion of the reset, all empty values were correctly filled.I’ll sit down tomorrow and have an analysis of the log but below is addition log event immediately AFTER the template reset, just if you’re interested.
Time to get some rest now…
PDb_Manage_Fields_Updates::update_fields update fields: UPDATE
wppd_participants_database_fieldsSETtitle= ‘Member Name Title’,group= ‘strings_fields_2’,form_element= ‘string-combine’,help_text= ”,options= ‘a:0:{}’,validation_message= ”,default= ‘[hapu]’,attributes= ‘a:0:{}’,signup= ‘0’,csv= ‘0’,readonly= ”,sortable= ‘0’,persistent= ” WHEREid= ‘235’After checking the log, it looks like it fails to save the string combine fields after submitting signup.
When I use the “force” update changes method you offered, the fields are stored with the correct values.
As long as the table can handle the number of record updates through the “force” update method, we should be OK.
Thanks Roland
-
This reply was modified 4 years, 7 months ago by
The topic ‘String Combine not saving in database’ is closed to new replies.