Jump to content

Duplicate pages_ids in a field_ DB table. Possible bug?


buddy
 Share

Recommended Posts

TL;DR: My mistake. I didn't read the docs.

Hi all,

My app is getting different data when querying a field from the API than the data in the same field in the CMS view. Obviously this is very weird, and should not be happening.

Looking at the database showed that the problem is being caused by two rows in this specific field_ table having the same pages_id with different data. One of the fields has sort=1, and the other sort=0, which is the only clue I have as to why this happened. The CMS view is grabbing the row with sort=1, and the API gets the one with sort=0 (just mentioning in case that's significant, though probably it's not).

This problem is easy enough to fix, but I'd like to make sure that it never happens again. I added this field recently in what I think is a normal way, and I haven't been doing any direct manipulation of the DB. Any ideas on what might have cause this so that I can avoid the problem in the future?

Thanks!

Update:

Okay, so I see how the duplicate rows are getting created. Every time I change the value of the field in the CMS view, it creates an extra row, with sort=1, sort=2, etc. I should mention that the data for this field is another page_id, since I've created a select dropdown dialog using the PageArray method.

Is this really the normal behaviour? It effectively means that after the first time that I change the value of the dropdown, I never see it through the API when I select on that field, since it seems to select the oldest version (sort=0).

Update 2:

Okay, I was curious as to why this DB table would even have multiple rows for the same pages_id, and that led to me realize that it's to support multiple select. I changed the field setting to "Single Page", and now it works normally.

Strange, though, that multiple select would be supported with a single select dropdown box, since the behaviour behind the scenes becomes invisible.

Update 3 - Fixed:

Okay, I now see that the 'input' tab of the field settings clearly states "Select one that is consistent with the single page vs. multi-page needs you chose in the 'details' tab of this field." My bad!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...