cancel
Showing results for 
Search instead for 
Did you mean: 

switch case like C

SOLVED
Omi_30
Member
Solved!

switch case like C

Hi all,

          Is it possible to use loop like switch case in C. Suppose one of my process generate numbers, like 1,2 ,3 4 n all, so if it generates 2 I want to perform task mentioned in event 3, if 2 then it should perform task mentioned in event 2. Please help me in this issue

13 REPLIES 13
Neos
Active Participant

Re: switch case like C

sounds like state machineSmiley Wink

Ranjeet_Singh
Active Participant

Re: switch case like C

Use event structure

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Ranjeet_Singh
Active Participant

Re: switch case like C


@Omi_30 wrote:

Hi all,

          Is it possible to use loop like switch case in C. Suppose one of my process generate numbers, like 1,2 ,3 4 n all, so if it generates 2 I want to perform task mentioned in event 3, if 2 then it should perform task mentioned in event 2. Please help me in this issue


2 - 2

3 - 3

 

Do you want for 2 for 2 and 3 for 3? 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Omi_30
Member

Re: switch case like C

Thanks for the reply.

 But in event structure it is accepting with Button only. When tried with Button (Value Change), the proper event gets called, but when tried with Integer generated by process, then it is not working, Can you get some example.

Highlighted
Omi_30
Member

Re: switch case like C

If one simple addition in previous step generate 2, then Event structure should execute task in Event 2..like this so on..so not getting how to handle the Event source as this generated integer

Omi_30
Member

Re: switch case like C

like in C , if input to Switch case is Integer 2, the Case :2 will get executed.So same thing I want to do in LV.

But dont know how to use this integer as Event source in event structure. Did succefully event structure with buttons normal as taking Value change.

 

I am new to LV Smiley Surprised

Ranjeet_Singh
Active Participant
Solution

Re: switch case like C

Message contains an attachment

Here

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
Neos
Active Participant

Re: switch case like C

Learn State machine.

You can trigger events for numeric values also usind Value ( signaling ) property but state machine will be better.

Make a decision in 1 state and based on the value switch to other states  

Omi_30
Member

Re: switch case like C

Thanks a lot for the solution. Also is it possible to automate button pressing, suppose I am having one button but insted of user pressing that,can I controll the Button inside, using one Boolean?