WinCC TIA 11 SP2 Recipe VBS

alexbeatle

Member
Join Date
Feb 2010
Location
San Francisco
Posts
188
Good day!

Trying to save changes in the recipe through VBS code.

There is one Recipe with several Recipe/Data Records.
Recipe Records is selected through drop-down menu (tag=PPreselectedDie)

The trick is that, there're 32 Recipe Elements and I'm displaying 12 at a time. There're scroll keys that move the list up and down by one.
So when I'm saving, I need to make sure that they all are saved to the right positions. This is done by the nested for-loops.

RecPPosAxis_Nom - the recipe tag, type=array
PPosAxis_Nom - I/O tag that displays the data on the screen, type=array

Code is executed onClick "Save" button.

Code:
Const numcol=32,numrow=12,limit=21
Dim RecipeRecord,x,y,status,count
RecipeRecord=HmiRuntime.SmartTags("PPreselectedDie")
For x = 0 To limit-1
 For y = 0 To numrow-1
  HmiRuntime.SmartTags("RecPPosAxis_Nom")(x+y)=HmiRuntime.SmartTags("PPosAxis_Nom")(y)
 Next
  If HmiRuntime.SmartTags("PPosAxis_Nom")(0)<=limit Then
   HmiRuntime.SmartTags("PPosAxis_Nom")(0)=HmiRuntime.SmartTags("PPosAxis_Nom")(0)+(numrow-1)
  End If
Next
SaveDataRecord 1,RecipeRecord,hmiOverwriteAlways,hmiOff,status

However, something doesn't do it.

Could you please have a look.

Thank you,

Alex
 
Hi alex,

What does const limit=21 represents?

I guess what you're trying to do is representing a sub array of length 12 of an array of 32 elements. Why don't you just do:

Code:
for x = offset to offset + numrow
	HmiRuntime.SmartTags("PPosAxis_Nom")(x - offset)=HmiRuntime.SmartTags("RecPPosAxis_Nom")(x)
next x

being offset a int ranging from 0 to 20 that changes when you press the scroll buttons.
 
Thanks, ruievmonteiro!

limit = the last 1st value of the sub-array. So when the PPosAxis_Nom[0]=limit-1, the last 12 items are shown on the screen and an operator cannot scroll forward further.

I don't quite follow, how does "next x" work? Please explain.

Alex

Hi alex,

What does const limit=21 represents?

I guess what you're trying to do is representing a sub array of length 12 of an array of 32 elements. Why don't you just do:

Code:
for x = offset to offset + numrow
	HmiRuntime.SmartTags("PPosAxis_Nom")(x - offset)=HmiRuntime.SmartTags("RecPPosAxis_Nom")(x)
next x

being offset a int ranging from 0 to 20 that changes when you press the scroll buttons.
 

Similar Topics

Good day, everyone! Has anyone had a problem with setting softkey (F-keys) functions on the template? Basically, there're 2 templates with...
Replies
2
Views
1,587
In our production plant we have multiple different networks (subnets). IT dept have setup routing between them so different subnets can...
Replies
0
Views
99
I created a project with Tia portal wincc runtime advanced PC station and also activated its smartserver for some smartclients to connect to it...
Replies
1
Views
325
Hello, just started my first project with a unified HMI. I want to use an image as background, how is this accomplished?
Replies
1
Views
544
Hi all, I really need help with this one. I'm at a complete loss... For months and months, I've had no problems with pressing a NEXT button to...
Replies
14
Views
1,444
Back
Top Bottom