If then statement--help

Tacec

Member
Joined
Jun 14, 2005
Messages
18
Location
Renton, WA
Programming Experience
1-3
Lets see, how to describe...

Im building a program with an ms agent which says a canned message, pulled from a table. If messageA in the table is stated by the agent, it should do X actions. If the active message is changed to another message in the table, the agent should do Y actions. The active message is always set to 1.

VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] NotificationID_New [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Integer
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] NotificationID_Old [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Integer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2][COLOR=#000000] IsVisible [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#000000] [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Boolean[/COLOR][/SIZE][SIZE=2][COLOR=#000000] = [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] 
If[/COLOR][/SIZE][SIZE=2] tmpDS.Tables("Notification").Rows.Count > 0 [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]NotificationID_New = tmpDS.Tables("Notification").Rows(0).Item("NotificationID")
 
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] NotificationID_New <> NotificationID_Old [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Show()
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Play("Greet")
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Play("Wave")
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Play("Alert")
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Speak(tmpDS.Tables("Notification").Rows(0).Item("Title"))
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Speak(tmpDS.Tables("Notification").Rows(0).Item("Message"))
IsVisible = [/SIZE][SIZE=2][COLOR=#0000ff]True[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000] 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Else
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000] 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Show()
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Play("DoMagic1")[/SIZE]
[SIZE=2][COLOR=#0000ff]Me[/COLOR][SIZE=2].Merlin.Play("DoMagic2")[/SIZE]
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Speak(tmpDS.Tables("Notification").Rows(0).Item("Title"))
[/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Merlin.Speak(tmpDS.Tables("Notification").Rows(0).Item("Message"))[/SIZE]
[SIZE=2] 
[/SIZE][SIZE=2][COLOR=#008000]
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE]

I need a way to tell when the active message has been changed in the table, so that whenever it does change, the agent's actions are different than the original actions.
We tried using NotificationID_New and Old as a means to differentiate old message vs new, but I think I'm at a loss from here. Did this make any sense??

Anyone have any suggestions?
 
Both the NotificationID_New and Old are values taken from a table (Notification).
I don't even know if creating the NotificationID_New/Old variables is the best way to handle this anyway. Perhaps not.

I just need some info on how to designate when the message (or notificationID) has changed.

Thanks for the help! :)
 
Back
Top