question

ycb avatar image
ycb asked ycb commented

Issue when querying items with name

Hi,
I use InventoryContact to load items like this:

  1. Uri uri = InventoryContract.Item.contentUriWithAccount(CloverAccount.getAccount(getActivity()));
  2. String where = "name LIKE '%coca%'"
  3. CursorLoader loader = new CursorLoader(getActivity(), uri,
  4. null, where, null, null);

it was working fine, but recently it crashes

  1. Caused by: android.database.sqlite.SQLiteException: ambiguous column name: name (code 1): , while compiling: SELECT price_without_vat, item_menu_item.description AS menu_description, alternate_name, default_tax_rates, code, cost, taxable, item_group_uuid, hidden, count, uuid, unit_name, modified_time, item_menu_item.enabled AS menu_enabled, price, item_menu_item.name AS menu_name, item_menu_item.reason_code AS menu_reason_code, item.name AS name, price_type, item._id AS _id, sku, is_revenue, item_menu_item.image_filename AS menu_image_filename, color_code FROM item LEFT OUTER JOIN item_menu_item ON item.uuid=item_menu_item.item_uuid WHERE ((name LIKE '%coca%'))
  2.  

do you have any fix for this?

Inventory
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered ycb commented

Can you try updating your where to "item.name LIKE '%coca%'" for now and I will look into this in more detail.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ycb avatar image
ycb answered ycb commented

yes, this works,
but it is not a good thing. to put static table name 'item'.

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

HTML Editor


Add some details...
Characters : 0
Tab to the formatting toolbar with Alt/Option + F10. If inside toolbar, press ESC to return to editor. Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community