You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old October 14th, 2009, 04:57 AM   #1
blutak
Member
England

blutak is offline
 
Join Date: Oct 2009
Location: Manchester
Posts: 2
WinCC Flexible 2008

Hi everyone, new to the site but just want to say hi first.
Ive been trying to find a way to set a tag to 1 when logged in as a admin or another high level user and keep that same tag 0 when logged in as just an operator.
Ive tried writing a script but it doesnt seem to work, any ideas would be great!! Thanks!!


GetGroupNumber SmartTags("group number")
If SmartTags("group number") = "9" Or "2" Then
SetBit SmartTags("Engineering Bit")
Else
ResetBit SmartTags("Engineering Bit")
End If

when i run the script it just sets the bit as -1 in the tag simulator thing and wont change? Numbers 9 and 2 are the higher level Groups and anything else (in my case number 1) is the operator group number.
  Reply With Quote
Old October 14th, 2009, 06:00 AM   #2
Jeebs
Member
Belgium

Jeebs is offline
 
Join Date: Feb 2007
Location: Leuven
Posts: 807
Exactly how is this script triggered?
Where does "group number" come from?
  Reply With Quote
Old October 14th, 2009, 06:36 AM   #3
blutak
Member
England

blutak is offline
 
Join Date: Oct 2009
Location: Manchester
Posts: 2
im triggering it off the login button and some menu buttons, the group number as far as im aware gets written to the tag automatically after log in.
  Reply With Quote
Old October 14th, 2009, 06:41 AM   #4
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 10,885
Do not make a script for this !

Do it this way in stead:

Device Settings .. Scheduler.
Add a Job, to be triggered on the event "change user".
Add the following functions to the job:
"GetGroupNumber", assign to an internal integer tag.
"GetUserName", assign to an internal string tag.
"TraceUserChange".

You can now use the tags to show the current level and name of the user.
__________________
Jesper
  Reply With Quote
Old October 14th, 2009, 07:38 AM   #5
CharlesM
Member
United States

CharlesM is offline
 
Join Date: Aug 2005
Location: Arkansas
Posts: 1,085
Thats a cool idea but I have a question

Does the "change user" event run after the log in timeout? I know it should run when the user logs in but by default the user will be logged out after 5 minutes. If it does run on log out what values does it return?
  Reply With Quote
Old October 14th, 2009, 07:43 AM   #6
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 10,885
It does run at timeout. Because the user is logged out.
The userlevel or "group" returned is "0" (zero).
__________________
Jesper
  Reply With Quote
Old October 15th, 2009, 10:06 AM   #7
RMA
Member
Scotland

RMA is offline
 
RMA's Avatar
 
Join Date: Sep 2004
Location: North of Hamburg, Germany
Posts: 2,040
This is something I can use as well!

Jesper, do you know off-hand how long the String for the User Name can be? I can't find it anywhere in the help files.

Edit: While we're on the subject, how do you enter the DB adress in the String compare block (FC10 EQ_STRING). Looking at String functions I've used before it shows up as P#DB2.DBX40.0, but if I try to enter that, it stays red. Trying to enter it symbolically as '"HMI_DB".User_Name' didn't work either.

Another of these things you only do every couple of years and always forget how it works!

Last edited by RMA; October 15th, 2009 at 10:41 AM.
  Reply With Quote
Old October 15th, 2009, 04:11 PM   #8
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 10,885
Unfortunately I do not know how long the username can be.
Longer than what practically makes sense I guess.

Comparing strings by entering the symbolic names seems to work for me.
Maybe save the DB, shutdown the LAD/STL/FBD editor, and try again ?
__________________
Jesper
  Reply With Quote
Old October 16th, 2009, 02:06 AM   #9
RMA
Member
Scotland

RMA is offline
 
RMA's Avatar
 
Join Date: Sep 2004
Location: North of Hamburg, Germany
Posts: 2,040
Quote:
Maybe save the DB, shutdown the LAD/STL/FBD editor, and try again ?
Yes, that was the problem, saving the DB alone isn't enough, on reopening the editor this morning it worked fine, of course. If I'd tried to save the FC, that would also have solved the problem (or at least the change in the DB would have been recognised), but I didn't think of that at the time.

I've settled on thirty characters for the String, hopefully that will be enough for most people!
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Lost window in wincc flexible 2008 dean_ham LIVE PLC Questions And Answers 9 October 9th, 2009 06:42 AM
Drawings in WinCC flexible 2008 thorgalrose LIVE PLC Questions And Answers 6 August 4th, 2009 03:52 AM
WinCC Flexible Bug (ProAgent) 2008 ... ? Combo LIVE PLC Questions And Answers 3 July 29th, 2009 12:13 PM
Connecting wincc flexible 2008 to PLCSIM PDS LIVE PLC Questions And Answers 1 July 7th, 2009 09:52 AM
WinCC 2008 Flexible issues JOLTRON LIVE PLC Questions And Answers 3 March 25th, 2009 05:45 PM


All times are GMT -5. The time now is 08:48 PM.


.