I'm attempting to use suiteql to get a list of lin...
# suiteql
b
I'm attempting to use suiteql to get a list of lines on a fulfillment. It looks like under the covers there are duplicated lines with negative quantity. What is the best way to deal with this? Sample query:
Copy code
SELECT linesequencenumber, item, quantity, mainline, units FROM transactionline WHERE transaction = '7635'
And result More info in thread...
In this case there are four items. Grouping it by item seems problematic - what if the same item is on the fulfillment twice? Why does the first line show as the main; and it is the one with units? Filtering for only lines with units also seems problematic, as there could be an item that doesn't use unit of measure. 😬
r
The SuiteAnswer article 27017 talks about why you get multiple lines when using a saved search and gives the formula to exclude the same. Not sure how this applies to SuiteSQL, but the information might be useful.
Interesting, they suggest a mod by 3. Didn't know it was that deterministic, but I'll give it a shot!
r
I know it is weird! But it works for saved searches. I’ve used it for years.
b
That article is gold; thanks!
👍 1
s
Assuming this is a fulfillment from a transfer order, you can also use
transactionlines.transactionlinetype
to determine which line you want.
m
Or you can filter by account type. I find that to be clearer (and probably more future proof) than mod 3
👍 1
b
@Sandii it’s not a transfer order in this case. @michoel thanks. I’ll look into that. Modding seems like a hack. Like it will work great until it doesn’t.
Filtering by
iscogs = 'F'
also does what I need
c
Honest question that I don't know the answer to: will
iscogs = 'F'
filter as you expect for fulfillable non-inventory item types?
b
My full query params are
Copy code
itemtype IN ('InvtPart', 'Kit', 'Assembly') 
AND iscogs = 'F' 
AND taxline = 'F'
👍 1
r
Nice solution. Does the shipping line need to be handled?
b
In my case, no.