Page 1 of 1

No image in table error.

Posted: Mon Oct 30, 2017 8:02 pm
by Full Bleed
When attempting to pull an image from a table entry that has no image I'm getting this error:

Code: Select all

No Image available in function "tblImage" for table "Table Name".
Do I have to insert images into every table row to avoid this?

Since I'm pulling item data from a table that doesn't have an image for every item I'd rather see an X, or a question mark, or nothing at all when there is no available image.

Re: No image in table error.

Posted: Mon Oct 30, 2017 8:21 pm
by aliasmask
You can store which indexes have/don't have images in them and check that first. I would store that info in index 0 of table.

Re: No image in table error.

Posted: Mon Oct 30, 2017 9:44 pm
by Full Bleed
aliasmask wrote:You can store which indexes have/don't have images in them and check that first. I would store that info in index 0 of table.
Yeah... some of my tables are quite large though and adding the 0 index after the table is already built stick it down at the end of the table... so I guess I can create a macro to make a temp table to add them in order... delete current table and then rename the temp back to the original...

The items are a string list with 50 fields... so I could add another field for whether or not it has an image, but I was hoping there was some less clunky way to do it.

Re: No image in table error.

Posted: Tue Oct 31, 2017 2:03 am
by aliasmask
It doesn't matter where index 0 is in the table (I think), but you can rewrite the table with macros now without having to do it manually. You just have to do each table index first before rewriting it so you know what gets copied over. So, if you have a table with 50 entries and 10 have not images just put those indexes in an array first then have the macro do all the heavy lifting.

Re: No image in table error.

Posted: Tue Oct 31, 2017 2:20 am
by Full Bleed
aliasmask wrote:It doesn't matter where index 0 is in the table (I think)
It doesn't... I just don't like the way it looks when I add things and they're visually out of order. I often leave blanks to try and keep things grouped accordingly... but that doesn't always hold up... so making a table re-sort macro won't be a total waste of time.

I was just hoping that there was some simple trick to code in an "if table item doesn't have an image then use no image or use this image". I guess there isn't.

I think I'll just end up adding some generic <4k image to every entry.
but you can rewrite the table with macros now without having to do it manually
The newer table macros have made using tables as a database (instead of tokens as I have in the past) something I really rely on these days. I just wish there wasn't some of these little issues to work around.

Re: No image in table error.

Posted: Tue Oct 31, 2017 2:59 am
by Full Bleed
Full Bleed wrote:I think I'll just end up adding some generic <4k image to every entry.
Well... that didn't work.

You can't add an image to a table with a macro using setTableEntry. There is no image parameter. So I tried using addTableEntry and I ended up with double of all of my entries. That seems like a bug.

And you can't pull an image asset from another table using tableImage either... it produces a question mark.

So there doesn't appear to be a way to mass add an image asset to table entries.

Re: No image in table error.

Posted: Tue Oct 31, 2017 3:09 am
by aliasmask
It does work, but I think there was a non-intuitive reason for it not working. It's on another thread, I'll do a search.

edit: Yeah, here it is: http://forums.rptools.net/viewtopic.php ... 52#p265691

Re: No image in table error.

Posted: Tue Oct 31, 2017 4:14 am
by Full Bleed
aliasmask wrote:edit: Yeah, here it is: http://forums.rptools.net/viewtopic.php ... 52#p265691
Thanks. I'd gotten everything to work but the asset retrieval.

But it seems like there are two bugs to work around though:

1) addTableEntry doesn't overwrite an entry. Fix: Delete entry and then add.
2) The image ID parameter adds the redundant "asset://" prefix. Fix: substring out the prefix.

EDIT: #2 above will BREAK macros when the bug is fixed.