Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi community,
I used the above code to store the value of a field of a table into a variable, the field only has one value, 2012. Any ideas as to why this might be giving me nothing? Am I missing something in the syntax?
If I got it right, your MyTable has only one value in one row, but 19 rows in total, most of them NULL.
Peek() addresses a certain row in that table, but the first rows are all NULL, that's why you don't get a result back for your variable.
Let vVar2 = FieldValue('field',1);
does work in that case.
Hope this helps,
Stefan
Brandon,
I don't see anything wrong. See the attched, compare with your application.
Regards,
Michael
Very Bizarre,
I works just fine when the table the variable comes from is from an inline table, but not when the table is loaded from a qvd. In fact, the variable doesn't even show up in the document (when I try to put it as a variable in an input box.) after a reload unless it was already created.
It works for me with QVD load as well.
Are you sure that you do not delete your variable later in the script?
i am trying to think, maybe when you actually used this value, did you use $(variable)?
try debug reload see what that value is.
I believe the variable will not be created if the expression evaluates to NULL.
And QV won't give an error message if this happens.
Have you checked that table and field name are spelled correctly?
You can try, if these lines return any data:
Let vVar1 = peek('field',0,'MyTable');
Let vVar2 = FieldValue('field',1);
Let vVar3 = NoOfRows('MyTable');
Let vVar4 = FieldValueCount('field');
Would it be possible that you post your script code here?
Regards,
Stefan
I'm not going to lie folks. I did find a work around but come Tuesday when I get back, I'll test your suggestions and post the document here too.
Attached is the file with the oddity.
If I got it right, your MyTable has only one value in one row, but 19 rows in total, most of them NULL.
Peek() addresses a certain row in that table, but the first rows are all NULL, that's why you don't get a result back for your variable.
Let vVar2 = FieldValue('field',1);
does work in that case.
Hope this helps,
Stefan
Hi Brandon,
had a similar issue, but in my case just 'quotes' were missing...
wrong: peek(field,0,MyTable);
right: peek('field',0,'MyTable');
Not the answer to your question, but might be helpful for others.
Regards,
Bernd