Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I want to set an expression in script.
=if(GetSelectedCount(Import)=0,sum({<Year={$(=max(Year))},STATUS_CODE={350,360},REGIME={'C*'},Export=,TAXCODE={'ED'}>}TAX),sum({<Year={$(=max(Year))},STATUS_CODE={350,360},Export=,TAXCODE={'ED'}>}TAX))
I have written this expression in chart expression using set analysis .Now i want it to write in Script level.How to write it???
Thanks
Could you please give me some suggestion to write this expression in script??
sum({<Year={STATUS_CODE={350,360},REGIME={'C*'},Export=,TAXCODE={'ED'}>}TAX)
Try this
if(widmatch(STATUS_CODE,'350','360') or match(REGIME,'C*') or TAXCODE='ED',TAX) as TAX
hope it helps
Edited by Me:--
Sorry by mistake i write Or condition
if(widmatch(STATUS_CODE,'350','360') and match(REGIME,'C*') and TAXCODE='ED',TAX) as TAX
here you don't want to mention the sum simply in your expression used Sum(TAX) because your subtotal works on the basis of sum(fieldname)
your TAX field value is just like in expression sum(TAX) if you want total then put sum in expression then it gives the overall total which you get in expression like this way
sum(total TAX)
hope it helps
I dont understand with your or conditions as in my expression there is and condition .
So Please tell me
Thanks.
Hi,
How about:
if( (STATUS_CODE='350' or STATUS_CODE='360') and left(REGIME,1)='C' and TAXCODE='ED', TAX) as TAX
Regards,
Lester
Hi Lester,
But there is no sum condition.
Thanks
Hi Narendar,
Use Sum(TAX) in your expression or else calculate the sum in Load script by using
Tax:
LOAD
Sum(TAX) AS TotalTax
FROM TableName;
Hope this helps you.
Regards,
Jagan.
Hi Mohit,
Thanks for your reply.
But its not working. see the attached file.
Hi Jagan,
Thanks for your reply
could yopu please give the solution of whole expression in script means how to write it on script level.
sum({<Year={STATUS_CODE={350,360},REGIME={'C*'},Export=,TAXCODE={'ED'}>}TAX)
Hi,
Try like this
Table1:
LOAD
*,
If((STATUS_CODE= 350 OR STATUS_CODE= 360) AND LEFT(REGIME)='C' AND TAXCODE='ED', TAX, 0) AS CalculatedTax
FROM DataSource;
Tax:
LOAD
Sum(TAX) AS TotalTax
FROM Table1;
Now you can just use TotalTax in your expression.
Hope this helps you.
Regards,
Jagan.