• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. *Error* if: too few arguments (at least 2 expected, 1 given...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 2770
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

*Error* if: too few arguments (at least 2 expected, 1 given) - ((length(match_result) == 1))

saurabh96
saurabh96 over 2 years ago

i have list as 

rules_cadence = (list "LAY_TEST_1" "LAY_TEST_15" "LAY_DIODE" "LAY_DIODE_MISSING" "LAY_DIODE_AVAILIABLE")

i want that when i select "LAY_TEST_1" i get output as 1

when  "LAY_TEST_15" then 15

when ""LAY_DIODE" then DIODE

when ""LAY_DIODE_MISSING" then DIODE_MISSING

when "LAY_DIODE_AVAILIABLE" then AVAILABLE DIODE

AND WHEN I SELECT ALL THE OUTPUT WOULD BE  1,15,DIODE,DIODE_MISSING,AVAILABLE_DIODE

 i have written skill script but am getting an error-

rule get_value(string entry)
match_result = match(entry, "LAY_TEST_(\\d+)")
if(length(match_result) == 1)
return match_result[1]
else if(startsWith(entry, "LAY_DIODE"))
return "DIODE"
else if(startsWith(entry, "LAY_DIODE_MISSING"))
return "DIODE_MISSING"
else if(startsWith(entry, ""LAY_DIODE_AVAILIABLE""))
return "AVAILABLE DIODE"
else
return ""
endrule

result = buildString(foreach(item rules_cadence) get_value(item) ",")

how can i correct that issue

  • Cancel
Parents
  • p94todorov
    p94todorov over 2 years ago

    Something like this should return what you are looking for:


    yourStrignVar = <some of the options>
    returnVal = buildString(setof(str parseString(yourStringVar  "_") not(member(upperCase(str) list("LAY" "TEST")))) "_")

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • saurabh96
    saurabh96 over 2 years ago in reply to p94todorov

    Thanks p94todorov
    Can you explain in lil more detail?


    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • p94todorov
    p94todorov over 2 years ago in reply to saurabh96

    Well,

    it is simply parsing the string using "_" as a parsing character, getting rid of the extra words that you are not interested in ("LAY" and "TEST" in your case) and they the return value is being build from the remaining strings using again "_" to concatenate.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • p94todorov
    p94todorov over 2 years ago in reply to saurabh96

    Well,

    it is simply parsing the string using "_" as a parsing character, getting rid of the extra words that you are not interested in ("LAY" and "TEST" in your case) and they the return value is being build from the remaining strings using again "_" to concatenate.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Children
  • saurabh96
    saurabh96 over 2 years ago in reply to p94todorov

    Hello p94todorov
    thanks i got your point that parsing will eliminate the unnecessary field will give required o/p.

    but suppose in list rules_cadence = (list "LAY_TEST_1" "LAY_TEST_15" "LAY_DIODE" "LAY_DIODE_MISSING" "LAY_DIODE_AVAILIABLE") now

    when "LAY_DIODE_AVAILIABLE" is select from list then expected o/p should be this AVAILABLE DIODE, but in this case it will only eliminate LAY, how can GET O/P as AVAILIABLE_DIODE




    ALSO when we select all options from list how can we get o/p separated by , as buildstring

    as AND WHEN I SELECT ALL THE OUTPUT WOULD BE  1,15,DIODE,DIODE_MISSING,AVAILABLE_DIODE

    Thanks

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information