Spudhead
10-07-2002, 05:07 PM
God, this is sooo humiliating. I can't even get an "if" statement to work. I may as well admit that I like to be called "Brenda". Or something.
Anyway, this gets a little tricky cos I'm using a third-party component (PDFlib, if anyone knows it) to generate PDFs on the fly. But I'm just doing some debugging and found that it's not returning true on an "if" statement, and I've no idea why.
So - some code:
strTest="spot not set"
Do While Not rs.EOF
colorSpot=Cstr(rs.Fields("color_spot").value)
If colorSpot<>"null" Then
colorSpace="spot"
mySpotColor=oPDF.makespotcolor(colorSpot)
oPDF.setcolor colorType, colorSpace, mySpotColor, 0.9, 0, 0
strTest="spot set"
End If
oPDF.show_boxed colorSpot, fieldX, fieldY, fieldWidth, fieldHeight, "justify", ""
strTest="spot not set"
rs.MoveNext
Loop
I should add that you're only getting a snippet of code there, but the rest works fine. It's just that "if" statement.
Basically, I grab the spot color name; parse it as a string. If that string doesn't equal "null", set my little debugging string to "spot set".
The "oPDF.show_boxed" writes output to the PDF page - ordinarily I'd have a text field from the database in there. In the example above, I'm putting the debug output - the spot color. This variable is definitely getting set; I write colorSpot back to the page and it's not "null". But if I change the debug output so it writes the value of strTest, it ALWAYS writes "spot not set".
So what's that "if" statement doing?
Anyway, this gets a little tricky cos I'm using a third-party component (PDFlib, if anyone knows it) to generate PDFs on the fly. But I'm just doing some debugging and found that it's not returning true on an "if" statement, and I've no idea why.
So - some code:
strTest="spot not set"
Do While Not rs.EOF
colorSpot=Cstr(rs.Fields("color_spot").value)
If colorSpot<>"null" Then
colorSpace="spot"
mySpotColor=oPDF.makespotcolor(colorSpot)
oPDF.setcolor colorType, colorSpace, mySpotColor, 0.9, 0, 0
strTest="spot set"
End If
oPDF.show_boxed colorSpot, fieldX, fieldY, fieldWidth, fieldHeight, "justify", ""
strTest="spot not set"
rs.MoveNext
Loop
I should add that you're only getting a snippet of code there, but the rest works fine. It's just that "if" statement.
Basically, I grab the spot color name; parse it as a string. If that string doesn't equal "null", set my little debugging string to "spot set".
The "oPDF.show_boxed" writes output to the PDF page - ordinarily I'd have a text field from the database in there. In the example above, I'm putting the debug output - the spot color. This variable is definitely getting set; I write colorSpot back to the page and it's not "null". But if I change the debug output so it writes the value of strTest, it ALWAYS writes "spot not set".
So what's that "if" statement doing?