ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 01-20-2010
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 171
KelvinHo will become famous soon enough
Default Seek for some help in a simple question

Hi all,

As in the attached simple model, i want to filter out flowitems with different label

In the on entry trigger i put:

if (content(outobject(current,1)) ==0) /** first flowitem entry and set compare value) **/
{moveobject(item,outobject(current,1));
settablestr("Globalvariable",1,1,getlabelstr(item, "In"));}

msg("initem",getlabelstr(item,"In"));
msg("current",gettablestr("Globalvariable",1,1));

if (getlabelstr(item,"In") == gettablestr("Globalvariable",1,1))
{moveobject(item,outobject(current,1));} /** From 2nd flowitem only move when label value match**/

But all flowitem will go to "current" queue.....even the message shows from the two "msg" commands are different.

What's wrong in my logic??

Thanks.

Kelvin
Attached Files
File Type: zip test3.zip (56.2 KB, 179 views)
  #2  
Old 01-20-2010
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi,

When comparing text you need to use comparetext and not ==.

Try using comparetext instead of
Code:
getlabelstr(item,"In") == gettablestr("Globalvariable",1,1)
See the help for how to use comparetext.

Lars-Olof
The Following User Says Thank You to Lars-Olof Leven For This Useful Post:
KelvinHo (01-20-2010)
  #3  
Old 01-20-2010
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 171
KelvinHo will become famous soon enough
Default

Oh thanks, let me try this command

Kelvin
  #4  
Old 01-20-2010
Esther Bennett Esther Bennett is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 115
Downloads: 27
Uploads: 0
Thanks: 103
Thanked 116 Times in 50 Posts
Rep Power: 271
Esther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to allEsther Bennett is a name known to all
Default

Hello Kelvin,

If I understand correctly, you create items with different item types and different values for the label "In". If the second queue is empty you want to set your GlobalVariable table value to the value of the first item entering the second queue and only items with the same label value may also move to the second queue. Other items have to remain in the first queue, is this correct?

Because in your sample model the second queue has no output port, this would mean that you want all items with label "aa" in the second queue and all other items in the first queue.

The problem lies in the fact that you use the moveobject command in the onentry trigger.

Take a look at the following post:
http://www.flexsim.com/community/for...ght=moveobject

This post might also give you some insight, although it is about opening and closing ports and not the moveobject command
http://www.flexsim.com/community/for...hread.php?t=51

Esther


Thread Thread Starter Forum Replies Last Post
A simple question about “block” Vic Li Q&A 10 08-27-2009 11:20 AM
The "Simple Question" Thread Xavier Jackson Q&A 202 08-10-2009 09:44 AM
simple pallet question (i think) bsantens Q&A 2 03-23-2009 11:39 AM
simple question about "Separator" Vic Li Q&A 5 01-14-2009 09:45 PM
simple question for operators Kang Han Q&A 1 10-23-2008 08:35 AM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.