Remaining Text does not appear problem
Remaining Text does not appear problem
(OP)
Hi
I am not the best at Crystal Syntax and I know the following is bad syntax. But I cannot seem to get away for the code to work after many google searches. Basically, I am looking at 3 different fields and if they are blank then Stock if not then the filed entry. The last one is just a number 1 for Various in the field so I want it to return various. Not sure how to make this happen. Any help would be appreciated, thanks
if(isnull({148_vwWorksOrderReportFeed.Expr6})) then
"STOCK"
else
{148_vwWorksOrderReportFeed.Expr6}
if(isnull({WorksOrderHeader.udfCustomer})) then
"STOCK"
else
{WorksOrderHeader.udfCustomer}
if(isnull({worksorderheader.Various})) then
"STOCK"
else
{worksorderheader.udfCustomer} "Various"
I am not the best at Crystal Syntax and I know the following is bad syntax. But I cannot seem to get away for the code to work after many google searches. Basically, I am looking at 3 different fields and if they are blank then Stock if not then the filed entry. The last one is just a number 1 for Various in the field so I want it to return various. Not sure how to make this happen. Any help would be appreciated, thanks
if(isnull({148_vwWorksOrderReportFeed.Expr6})) then
"STOCK"
else
{148_vwWorksOrderReportFeed.Expr6}
if(isnull({WorksOrderHeader.udfCustomer})) then
"STOCK"
else
{WorksOrderHeader.udfCustomer}
if(isnull({worksorderheader.Various})) then
"STOCK"
else
{worksorderheader.udfCustomer} "Various"
RE: Remaining Text does not appear problem
if(isnull({148_vwWorksOrderReportFeed.Expr6})) then "STOCK" AND
IF (isnull({WorksOrderHeader.udfCustomer})) then "STOCK" AND
if(isnull({WorksOrderHeader.udfCustomerVarious})) then
"STOCK"
else
IF (not isnull({148_vwWorksOrderReportFeed.Expr6})) then {148_vwWorksOrderReportFeed.Expr6}
Else
IF (not isnull({WorksOrderHeader.udfCustomer})) then {WorksOrderHeader.udfCustomer}
Else
IF (not isnull({WorksOrderHeader.udfCustomerVarious})) then {WorksOrderHeader.udfCustomerVarious}
RE: Remaining Text does not appear problem
if(isnull({148_vwWorksOrderReportFeed.Expr6})) AND
if (isnull({WorksOrderHeader.udfCustomer}))AND
(({WorksOrderHeader.udfCustomerVarious})) = False
then
"STOCK"
else
if(not isnull({148_vwWorksOrderReportFeed.Expr6})) Then {148_vwWorksOrderReportFeed.Expr6} and
if (not isnull({WorksOrderHeader.udfCustomer}))Then {WorksOrderHeader.udfCustomer} AND
IF (({WorksOrderHeader.udfCustomerVarious})) = True Then {WorksOrderHeader.udfCustomerVarious}
RE: Remaining Text does not appear problem
I don't know the CR syntax but logically
If expression1 OR expression2 OR expression3 Then...
...where an expression returns True or False.
Skip,
Just traded in my OLD subtlety...
for a NUance!
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
You Matter...
unless you multiply yourself by the speed of light squared, then...
You Energy!
RE: Remaining Text does not appear problem
As to why the latest code fails, it is because of the line:
, specifically the 'and'.
After a 'Then' either the code must finish, or be followed by an 'Else'.
I would suggest explaining the logic in words and we can try and turn that into code for you.
Mixing ANDs with ORs can be a challenge. My approach is always to use brackets to force the order of evaluation. Personally, I find formatting the code using indents makes it much easier to read and ensure the correct logic has been applied. Something like this for example:
CODE
Hope this helps
Cheers, Pete
RE: Remaining Text does not appear problem
CODE
Again, explaining the logic in simple words so we can turn it into working code is probably the best way forward.
Pete
RE: Remaining Text does not appear problem
pamx9999 I tried your code but changed the AND's to OR but I am getting a message saying a string is required on the last IF, any ideas
I will also try and explain what I need.
We have a works order and on the order header it displays if the order is for Stock or for a specific customer.
1. To get this it looks on the Works Order to see if a sales order number is if there is one it displays the customer name, if there is not a sales order number it displays stock.
({148_vwWorksOrderReportFeed.Expr6})
We now have a couple of new fields which we need to take into account when entering a works order and they follow the same principle
2. If 1 is blank to look at udfcustomer to see if that is blank. if there is a name there it needs to display on the header with the customer name if blank it needs to be stock
{WorksOrderHeader.udfCustomer}
3. If 1 and 2 are blank to look at udfCustomerVarious to see if true then it needs to display Various if false then Stock. This is is just or 1 in the databse but I want it ti disolay Various if = 1
WorksOrderHeader.udfCustomerVarious
Hope that explains it
Many thanks for your replies, I will try and see if I can crack it during the day, there may be a time difference between our locations
RE: Remaining Text does not appear problem
3. If 1 and 2 are blank to look at udfCustomerVarious to see if true then it needs to display Various if false then Stock. This is is just or 1 or 0 in the database but I want it to display Various if = 1
WorksOrderHeader.udfCustomerVarious
RE: Remaining Text does not appear problem
Ok my code is looking as below now, I am getting an error The keyword 'then' is missing after the "Various", exhausted all ideas on this. Close but no cigar unless I am way off base with what I am doing , any ideas please people.
IF (isnull({148_vwWorksOrderReportFeed.Expr6})) OR
IF (isnull ({WorksOrderHeader.udfCustomer})) OR
IF (({WorksOrderHeader.udfCustomerVarious})) = False
Then "Stock"
Else
IF not isnull({148_vwWorksOrderReportFeed.Expr6})
THEN {148_vwWorksOrderReportFeed.Expr6}
Else
IF not isNull({WorksOrderHeader.udfCustomer})
Then {WorksOrderHeader.udfCustomer}
Else
If {WorksOrderHeader.udfCustomerVarious} = True
Then "Various"
RE: Remaining Text does not appear problem
1. If no Customer Name and no udfcustomer name and udfcustomervarious is false (non-boolean 0?) then Stock
2. If no Customer Name and no udfcustomer name and udfcustomervarious is true (non-boolean 1?) then Various
3. If no Customer Name and udfcustomer name exists then udfcustomer name
4. if Customer Name exists then Customer Name
If the above is correct then this should get you close. It is untested and may contain typos.
CODE
RE: Remaining Text does not appear problem
Thanks fisheromacs I adapted a few areas it complained about (typos) but I think that has worked. I need to test on a wider scope of works order numbers but the 3 I have tested for each possible scenario has worked. Will get more testing done and inform back. Many thanks