how to put more than one field in a swith condition

Stimulsoft Reports.JS discussion
Post Reply
flehmann36
Posts: 3
Joined: Fri Jan 26, 2024 10:13 am

how to put more than one field in a swith condition

Post by flehmann36 »

Hello, I am despairing...

I hope someone can give me a tip.

I have different fields that I retrieve that produce a number without any blank lines in between. I would like to display this number in a switch selection

The error must be in the syntax somehow, but I can't figure it out

{Objekt.OBJEKT_INTNR}{Format("{0:yy}", Vorgang.VORGANG_VON)}{Month(Vorgang.VORGANG_VON)+80} + Schlüsselsymbol

shows "112392 + Schlüsselsymbol"

if i Copy this into the switch...

{Switch(
Objekt.OBJEKT_INTNR == "11", {Objekt.OBJEKT_INTNR}{Format("{0:yy}", Vorgang.VORGANG_VON)}{Month(Vorgang.VORGANG_VON)+80} + Schlüsselsymbol,
Objekt.OBJEKT_INTNR == "5","xxxxx")}

the is an error "}" expect.

I've tried everything with and without brackets etc

Thanks a lot from Germany

Fabian
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: how to put more than one field in a swith condition

Post by Lech Kulikowski »

Hello Fabian,

Please explain what result do you need?

Full expression should be in one {} brackets, for example:
{"Test1"}+{"Test2"}
result:
"Test1"+"Test2"

{"Test1" + "Test2"}
result:
"Test1Test2"

Thank you.
flehmann36
Posts: 3
Joined: Fri Jan 26, 2024 10:13 am

Re: how to put more than one field in a swith condition

Post by flehmann36 »

thank you for the answer Lech.

the problem is, i need the expression in a switch.

this one: {Objekt.OBJEKT_INTNR} {Format("{0:yy}", Vorgang.VORGANG_VON)} {Month(Vorgang.VORGANG_VON)+80} + Text

I need in Switch
{Switch
(
Objekt.OBJEKT_INTNR == "11", {Objekt.OBJEKT_INTNR} {Format("{0:yy}", Vorgang.VORGANG_VON)} {Month(Vorgang.VORGANG_VON)+80} + Text,
Objekt.OBJEKT_INTNR == "5","xxxxx"
)}

I've tried everything with and without brackets etc there are always mistakes.

Thanks

Fabian
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: how to put more than one field in a swith condition

Post by Lech Kulikowski »

Hello,

Try to check;
{Switch
(
Objekt.OBJEKT_INTNR == "11", Objekt.OBJEKT_INTNR+Format("{0:yy}", Vorgang.VORGANG_VON)+Month(Vorgang.VORGANG_VON)+"80"+"Text",
Objekt.OBJEKT_INTNR == "5","xxxxx"
)}

Thank you.
flehmann36
Posts: 3
Joined: Fri Jan 26, 2024 10:13 am

Re: how to put more than one field in a swith condition

Post by flehmann36 »

Sorry for answering late. Unfortunately I was sick.

Thank you so much, that was the right answer. I would never have been able to do that. Thank you thank you thank you!
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: how to put more than one field in a swith condition

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply