ERROR Undefined offset: 0 in pdfreport

I want to show or hide field or picture like checkbox when I change listbox value, But I faced many issue to do that.
Can you please help me?
when I choose holiday type in this form


I want to check this in pdfreport like this:
image
if ({Holiday_Type} == “External”)
{
sc_field_display({Holiday_Type1}, on);
}
else
{
sc_field_display({Holiday_Type1}, off);
}

I try this also:
if ({Holiday_Type} == “External”)
{
sc_field_display({Holiday_Type1}, on);
sc_field_display({Holiday_Type1}, off);
}

mmmm… in pdf report sc_field_display work?
I would define an auxiliary field, and give it value according to the condition …
if ({Holiday_Type} == “External”) {
{myField} = ‘External’
} else {
{myField} = ‘Internal’
}

1 Like

Thanks you for your response, I appreciate that.
But I want to show another fields (Holiday_Type1,Holiday_Type2,…) based on values in current field (Holiday_Type).

It simple… create a new field, (HolidayType_Display), and asign value…
if ({Holiday_Type} == “External”)
{
{HolidayType_Display} = {Holiday_Type1};
} else {
{HolidayType_Display} = {Holiday_Type2};
}

1 Like

Thank you again for your attention and help me
I will try it
Sincere thanks and appreciation

I tested it, but not work.

I Think you script must do it into event OnRecord.(But The manual say: The macro sc_field_display does not works for PDF report).
But you can asign empty field to yours fields. like @asantarelli says. In event OnRecord

1 Like

I try many times but no way.

I do it already, But no way

Can you show a screenshoot your code.

There is a post with same issue: Enabling and disabling field scriptcase reports - #3 by Sanjesh_Lal
I think is not possible,

For Solve, it I think you must change your SQL Query. Put your condition in your query.

1 Like

Hide field in PDF Report - Scriptcase 9 / General - Scriptcase

One option is that you do not put an image, you must put a text with the value according to the condition.