Cannot display information.

Discussion in 'Cadence' started by Hon Seng Phuah, Apr 28, 2004.

  1. Hi all,

    I do not understand why these code cannot work:

    procedure( trSelectedResult(mainForm)
    let( (selectedValue filePath revNo)
    selectedValue = car(mainForm->trSearchResult->value)
    if( selectedValue != nil
    selectedValue = parseString(selectedValue " ")
    if( eq("Email:" nthelem(1 selectedValue))
    filePath = nthelem(2 selectedValue)
    mainForm->trViewButton->enabled = t
    printf("%s" filePath)
    )
    )
    )
    )

    if I remove the printf statement, it works. Anyone has any idea what my problem is?

    Thanks.
    -HS Phuah
     
    Hon Seng Phuah, Apr 28, 2004
    #1
  2. Hon Seng Phuah

    S. Badel Guest

    i think it's because then and else are missing in the
    if statement.

    there are two possible syntax, one with then-else and one without.

    from the SKILL reference :

    if(
    g_condition
    g_thenExpression
    [ g_elseExpression ]
    )
    => g_result

    if(
    g_condition
    then g_thenExpr1 ...
    [ else g_elseExpr1 ... ]
    )
    => g_result

    notice there are no ellipsis (...) in the first syntax, this means
    only one statement is allowed. In other words, you can use
    it as a shorthand for a simple if statement.

    this said, i think that your code didn't work either without the
    printf statement, because the second statement
    (mainForm->trViewButton->enabled = t)
    was actually in the else-clause which doesn't look like what
    you intented. When there's no else clause you can use the
    when statement when( condition expr ... ) it's easier.

    hope this helps,

    stéphane

    ps:
    also, next time you post such a question you should tell
    WHAT doesn't work, not just 'it doesn't work', you'll have
    better chances to get an answer.
     
    S. Badel, Apr 28, 2004
    #2
  3. You need a then in your if. Without it, you can only have two
    statements, a then clause and an else clause. From what you have
    written, you need the then even without the printf to have the behavior
    you appear to want.

    if( eq("Email:" nthelem(1 selectedValue))
    then
    filePath = nthelem(2 selectedValue)
    mainForm->trViewButton->enabled = t
    printf("%s" filePath)
    )
     
    Diva Physical Verification, Apr 28, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.