April 5, 200620 yr Do you think the following can be optimezed if you have many of these lines? (@c:NearestAirportCurrentIdent,string) 'EHAM' scmp ! if{ 1 (>L:String Value, enum) } (@c:NearestAirportCurrentIdent,string) 'EHBK' scmp ! if{ 2 (>L:String Value, enum) } (@c:NearestAirportCurrentIdent,string) 'EHEH' scmp ! if{ 3 (>L:String Value, enum) } Roelof
April 5, 200620 yr Hi,This could be a good approach: (@c:NearestAirportCurrentIdent,string) sp00 sp1 :0 'EHEH' 'EHBK' 'EHAM' 3 l1 case l0 scmp l1 2 <= and if{ l1 ++ sp1 g0 }l1 2 > ! l1 ++ * (>L:String Value, enum)You can compare as much as 25 different strings with this snippet.Another approach would be neccesary in case more are needed.TomEDIT: Modified to leave (L:String Value, enum) in 0 if none of the strings matchs the varAnd if you find it rather complex, this should work ok too:c(@c:NearestAirportCurrentIdent,string) sp0l0 'EHAM' scmp ! if{ 1 }l0 'EHBK' scmp ! if{ 2 }l0 'EHEH' scmp ! if{ 3 }(>L:String Value, enum)For a few strings this seems to be more appropriate :-)
April 6, 200620 yr >Hi,>This could be a good approach:>For a few strings this seems to be more appropriate :-)Thanks Tom. I'll have a go at it and report back.c <---------------------------- Has this any meaning?(@c:NearestAirportCurrentIdent,string) sp0l0 'EHAM' scmp ! if{ 1 }l0 'EHBK' scmp ! if{ 2 }l0 'EHEH' scmp ! if{ 3 }(>L:String Value, enum)Roelof
April 6, 200620 yr Hi,Yes, afaik it clears the stack, so in case of "bad" code, calc's will stop. Jan"Beatus ille qui procul negotiis..." Jan "Beatus ille qui procul negotiis..."
April 6, 200620 yr >Hi,>>Yes, afaik it clears the stack, so in case of "bad" code,>calc's will stop. >>Jan>>"Beatus ille qui procul negotiis..."Hi Jan,So that is what it is. The last code works really well. Didn't try the first one.Credits to Tom.Roelof
Create an account or sign in to comment