Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New QB Address field breakage #2

Open
grahamdavies opened this issue Jun 13, 2014 · 3 comments
Open

New QB Address field breakage #2

grahamdavies opened this issue Jun 13, 2014 · 3 comments

Comments

@grahamdavies
Copy link

I keep getting key errors when using query with a table that contains the new QB address fields. The 'hidden' fields for the address components do not have a label in fields[field.attrib['id']] and so you get a key error.

Could you also explain how queries are formed? I can't see how to map a QB query - such as - {'fid'.operator.'matching_value'} - onto a python dict.

Thanks

@nhynes
Copy link
Collaborator

nhynes commented Jun 15, 2014

I keep getting key errors when using query with a table that contains the new QB address fields.

I'm not familiar with the new QB fields. Could you please describe the issue in more detail and perhaps include a link to relevant documentation?

Could you also explain how queries are formed?

To execute a query, just set the query string as the query key of the input dict. I would recommend using the SQL function, though. For instance, you could do

SELECT * FROM table WHERE fid`operator`matching_value

@grahamdavies
Copy link
Author

Hi - thanks for the quick response - sorry I thought this was an official Quickbase API.

The new address fields are quite unique. They are composed of multiple fields when output to CSV but in QB they appear as a single field with the ability to Google an address.

http://quickbase.intuit.com/developer/knowledge-base/how-do-i-update-my-app-use-new-address-fields

I did some tests and the Key Error occurs because the hidden fields do not have an 'id' when accessed via the method you use. If you add the following then it 'fixes' the issue but you can't tell which fields are which as far as I can see (e.g. postcode versus state versus street etc).

            if(field.tag == "f") and 'id' in field.attrib:
                if field.attrib['id'] in fields:
                    temp[fields[field.attrib['id']]] = field.text
                else:
                    bodge = "Address-%s" % ( field.attrib['id'] )
                    temp[bodge] = field.text

I previously used the API from https://github.com/oysterhotels/quickbase, which seems to get the field names without spaces and in their original format - but this also breaks with the new addresses because the field for State/Region includes an illegal character '/' when trying to edit!

Thanks for the SQL query - I've got that working now. I had assumed you would submit a 'Field Name'.XCT.'Value' style query via your query() function somehow.

@grahamdavies
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants