I have an application that is talking back and forth with a SQL database for Inventory.
I created the cards for mobile application, and found that I need to apply an index to the instances because the Cards do not have a highlight feature like the table does.
I have looked around on the forums and I have found some code that was suggest, but it seems I am still missing something as it gives me an error.
I want to be able to select a card and have it “move” data into a TabContainer that will allow an operator to checkout/edit inventory.
You might want to tell us what the error is, because nothing is apparent from the screenshot, supposing that is the code you're talking about.
Concerning the code, I'm not sure what the query should be returning, but I doubt the script transform is using it properly: It expects value to be an integer, which is probably not the case since you're using select *.
By the way, the whole script transform can be written like this:
def transform(self, value, quality, timestamp):
return [{'index': i} for i in xrange(value)]
In short: Show us what you're actually doing (query, code, bindings...), and the relevant results (the error in this case)
I have attached screen shots of the Query, what it is returning and the property I am binding that information to.
Since the Flex Repeater does not have a highlight, I have to assign an index to each of the instance that is returned. There could be 1 instance or 100.
SELECT row_number() as Index,PartNumber,ItemCode,Description,Quantity,ProductPrice
FROM Inventory
WHERE
PartNumber LIKE :PartNumberString OR
ItemCode LIKE :PartNumberString OR
Description LIKE :PartNumberString
ORDER BY
PartNumber ASC
If you care about the index of the row number then you can add the OVER() function in as well.
SELECT row_number() over(ORDER BY PartNumber ASC) as Index, PartNumber,ItemCode,Description,Quantity,ProductPrice
FROM Inventory
WHERE
PartNumber LIKE :PartNumberString OR
ItemCode LIKE :PartNumberString OR
Description LIKE :PartNumberString
ORDER BY
PartNumber ASC
As for why your code is erroring, as @pascal.fragnoud stated, the range() function is expecting an integer value, however, value is actually an array