I am building a Vendor Database. In this DB there is a view called By Company. In the view Column 1 has this code, @If(Rating=“Good”; " Vendor Rating–> " + Rating + " Date: " + @Text(RateDate) + " By " + CreatedBy; Rating=“”;“”;0), which works well and show the information I need.
Column 2 has this code, @If(ConTrain=“Yes”;" Trainee–>" + Trainee + " Renewal Date: " + @Text(ExpiryDate); ConTrain=“No”;“”;0), which only shows “0”.
I have tried many changes, but can’t get column 2 only the 0.
Anyone have any ideas on this problem.
Thanks
Phillip
Subject: @if problem “Code included”
First check the name of the columns in your view (last tab on the properties window). They must all be different.
When that is not the case, you could build up your formula step by step. E.g. first display @If(Rating=“Good”; " Vendor Rating–> "; "not good’) and see if give the desired result. Then add some extra parts in your formula until you have the comlete result.
Subject: @if problem “Code included”
In addition to Rob’s suggest you could try this:
@If( ConTrain=“Yes”;
" Trainee-->" + Trainee + " Renewal Date: " + @Text(ExpiryDate);
ConTrain="No";
"";
"Unexpected value for ConTrain=[" + ConTrain +"]"
)
Something I would guess: ConTrain is blank or ConTrain is YES or NO or if ConTrain is tied to a keyword where you setup an alias and maybe it’s Y or N; 1 or 0
@If( @UpperCase(ConTrain)=“YES”;
" Trainee-->" + Trainee + " Renewal Date: " + @Text(ExpiryDate);
@UpperCase(ConTrain)="NO";
"";
"Unexpected value for ConTrain=[" + ConTrain +"]"
)
Subject: RE: @if problem “Code included”
Thank you all for your help. The information you gave me helped me get it right. Now I only have one column and here is what I used. @If( @UpperCase(ConTrain)=“YES”;
" Trainee–>" + Trainee + " Renewal Date: " + @Text(ExpiryDate);
@UpperCase(Rating)=“Good”;
“”;" Vendor Rating–>" + Rating + " Date: " + @Text(RateDate) + " By [" + CreatedBy +“]”)
Thanks again
Phillip
Subject: @if problem “Code included” (You have a TYPO in your code)
You have a typo in your code - I’ve made this mistake FAR to often:
@If( @UpperCase(ConTrain)=“YES”;
" Trainee–>" + Trainee + " Renewal Date: " + @Text(ExpiryDate);
@UpperCase(Rating)=“Good”;
“”;" Vendor Rating–>" + Rating + " Date: " + @Text(RateDate) + " By [" + CreatedBy +“]”)
Make it
@If( @UpperCase(ConTrain)=“YES”;
" Trainee-->" + Trainee + " Renewal Date: " + @Text(ExpiryDate);
@UpperCase(Rating)="GOOD";
"";
" Vendor Rating-->" + Rating + " Date: " + @Text(RateDate) + " By [" + CreatedBy +"]"
)
Subject: @if problem “Code included”
Try setting your second column to just the simple value of ConTrain to see what you are dealing with. There is nothing wrong with your test - I am guessing that the field name is incorrect or the values in it are not what you are expecting.