Dropdown from Vlookup - list

I'm trying to make a little tool for a card game, which would allow the players to check the stats of the cards. The idea is to have three dropdowns, Name, Rarity and Variant:
The player select their card, add the rarity and choose the version if it's variant or not. Then, a vlookup brings that card's info. The first two dropdowns are easy, the thrid one not so much. I tried using
=IFERROR(Query('Cards'!A:E;"select E where A='"&A2&"' and C="&B2&" and D = '"&C2&"' ";0))
but it only works if a card only has variants with different rarity. If a card has two variants with the same rarity (like Moritaka in the image) it shows both versions. I need the player to be able to choose which variant is the correct one. A vlookup checking the other two and adding the content of the Variant2 column to a dropdown would be perfect, but I can't manage to make one.
Here is the full sheet: https://docs.google.com/spreadsheets/d/1tldaFq-YD5-as_1CrMBNh1i116OLO-MIl7Un_mjm0jo/edit?usp=sharing

Related

Sales list force change of column in lines

I'm using the page below a POS sales list. Here the user can use the barcode pistol and pass the article and the code is translated into the item no.
The problem is when they use the pistol and end to pick a item and want to pass to next one the line go automatically to the first column (Item type) and my goal was to force to go into the second column (Item no), because the Item type is by default the type "product".
Only change the order of columns of Item no to Item product is not enough in this case.
Since ACTIVATE is not supported for controls in RTC.
Not many good options here.
Try using QuickEntry Property. Set it to false for all controls on subpage except No..
Create custom page with as less fields as possible, use it as buffer to scan all items and create sales lines upon closing of this new page. You can implement desired behavior on this page and keep original page almost unmodified
Create add-in that will intercept scanner output somehow.

Select one record from related table if exists, else return None

I have this two models:
class Box(models.Model):
class BoxImages(models.Model):
box=models.ForeignKey(Box)
img=models.ImageField()
cover=models.IntegerField(default=0)
Only one image can be a cover image for a box and a box might not have any images at all. What I want now is to get list of boxes along with their cover image. But django uses inner join and brings boxes that have corresponding cover images only.
Box.objects.filter(box_boximages__cover=1).values('id','box_label')
How do I force it to go with left join or left outer join since i read the ORM decides on its own which join to use?
If you want to have all boxes, no matter whether they have a cover image or not, just drop the filter. The filter effectively reduces your queryset to only those Boxes that have a cover image.
Box.objects.select_related('box_boximages').values('id','box_label', 'box_boximages__cover')
select_related will fetch the related BoxImages in the same query (if they exist). The queryset will contain all Box objects, even if they don't have BoxImages.
EDIT:
It returns all images; the box appears 5 items cos there are 5 pictures for it.
Yes, you are correct. values will add entries per fkey relation. There are several ways to cope with that.
(a) simplest is, not to use values but simply iterate over the queryset and use the Box instances with their related BoxImages. The code will be easy to understand. With the select_related you should also be fine performance wise.
(b) use aggregation to only fetch the box images that are covers. Have a look at the aggregate function. You can use it in combination with Exists to find the cover images (or Max).
(c) Create two QuerySets, one with Boxes without BoxImages and the other using the BoxImage Covers to get all the related Box instances. Combine those two.
Personally, I think (a) is the simplest and therefore best to understand when reading the code at a later point or for other developers.
If you always end up selecting based on cover versus not-a-cover image and you have the freedom to change the models then you could think about using two models + model inheritance and create BoxCover (OneToOneRelation to Box) and BoxImage (n:1 to Box) models. This would be the easiest to understand and handle.

Merge cells with similar but different data, different spelling

I am trying Tableau with data extracted from Salesforce. The input includes a "Country" record were the row have different spellings for the same thing.
Example: Cananda, CANADA, CAnada etc.
Is there a way to fix this in Tableau?
The easiest solution is create a group field based on your Country field.
Select Country in the data pane on the left side bar, right click and choose Create Group. Select elements that you want to group together put them into a single group, say Canada, that contains all variations of spelling.
This new group field initially has a name of Country (group). You may want to rename it Country_Corrected. (Or even better, rename the first field, Country_Original, and call the group field simply Country. Then you can hide Country_Original)
Groups are implemented using SQL case statements. They have many uses, but one application is to easily tolerate some inconsistent spellings in your data source without having to change your data. In general, you can specify several transformations like this that take effect at query and visualization time. For very large data sets, or for very complicated transformations, you may eventually want to push some of them upstream in your data pipeline to get better performance. But make those optimizations later when you've proven the necessity.
If the differences are just in case (upper vs lower), you can right-click the Country dimension, and create a calculated field called something like "New Country", and use the following formula to make the case consistent:
upper([Country])
Use this new "New Country" calc dimension instead of your "Country" dimension, and it will group them all without case sensitivity, and display as uppercase. Or you can use "lower" instead of "upper" if preferred.

how to add a list with different product sizes in opencart?

i'm have to make a webshop with opencart.
The person who i am making this website for, wants to sell cooking pans, with different sizes.
so, if you click on a product, there has to be a list with the different sizes of the cooking pans, and different prizes.
Is this possible ?
many thx !
This, of course, is possible :-)
All You need to do is to set the product options. In Opencart administration, go to tab Catalog and select the Options item. Crete an option, let's call it Pan sizes and choose a form field for it - whether a radio buttons or select would be OK for it. After saving You would have to add Pan sizes option's values - here You can set all the possible sizes of the pans. When You are finished You can assign that option and set the concrete possible size options in the product detail -> open up the desired product, choose the Options tab and add an option - Pan sizes. Then add all the relevant sizes options and adjust the pieces count, price that is added or subtracted as well as other options there and hit Save at the end.
You should be done.

variable date option in opencart

1st I want to remove text field for date so the calendar will replace it.
2nd I want to make the status order.. I want to sell the service, so I need to make booking order by calendar. If the date is green client can make an order. If red the client can't book an order. If yellow there certain items can be ordered.
I hope someone can help..
Thanks.
You have to try something at least and ask only for advice then.
Anyway, few suggestions:
it cannot be done using that option field of type date, at least not with the default datepicker.
You will need to create Your own datepicker component that will search for free/partialy/fully ordered days in the database and color the table cells accordingly.
It is not very wise to hide the input - by this visible user could anytime check what date did he pick - if it is not visible he would need to always open the datepicker to check for it...
Disallowing to order some service based on some reservations is highly decreasing Your conversion rate - thus decreasing Your income. I would definitely go the way let the user buy/order anything at anytime while having separate reservation system. If user buys a service at thank You page I would recommend him to book a concrete date for the service to be drawn. Here You do not need to fight with product options which are meant totally for something different that You are trying to.
Keep that in mind (mainly the 4th point) and re-think Your problem.