on 2023 Nov 29 8:32 PM
I am trying to setup a FS that computes the square footage (SF) of an item based on the purchase length and width. I created two UDF's on the Item Master one Compute SF which is a simple Yes or No and a UDF to hold the computed SF, this field is a quantity type field.
I have tried different versions of queries and here are the results.
Query
SELECT ($[$10.0.0]/12)*($[$99.0.0]/12)
FROM OITM T0
WHERE T0.ItemCode = $[$5.0.0] AND $[$BOYX_1.0.0] = 'Y'
Result
SELECT (N'36"'/12)*(N'48"'/12)
FROM OITM T0
WHERE T0.ItemCode = N'Test2' AND N'Y' = 'Y'
Query trying to cast the fields to integer and get rid of the "
SELECT ((CAST $[$10.0.0] as INT)/12)*((CAST $[$99.0.0] as INT)/12)
FROM OITM T0
WHERE T0.ItemCode = $[$5.0.0] AND $[$BOYX_1.0.0] = 'Y'
Result
SELECT ((CAST N'36"' as INT)/12)*((CAST N'48"' as INT)/12)
FROM OITM T0
WHERE T0.ItemCode = N'Test2' AND N'Y' = 'Y'
I have tried queries trying to remove the " and N from the results and that does not work either.
SELECT (REPLACE(REPLACE($[$10.0.0], '"', ''), 'N', ''), (REPLACE(REPLACE($[$99.0.0], '"', ''), 'N', '')
FROM OITM T0
WHERE T0.ItemCode = $[$5.0.0] AND $[$BOYX_1.0.0] = 'Y'
I can get this query to work but it is not going to be sufficient because I need to read the length and width prior to adding the item.
Query
SELECT (T0.BLength1/12)*(T0.BWidth1/12)
FROM OITM T0
WHERE T0.ItemCode = $[$5.0.0] AND $[$BOYX_1.0.0] = 'Y'
Does anyone have any recommendations to get this working for me?
Thank you in advance, Jeff
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
User | Count |
---|---|
87 | |
8 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.