Jump to content

How to pass a variable to "Printout header data" dialog boxes after clicking on "Start"?


---
 Share

Recommended Posts

Something about the logic in this PCM is not working. Or the value entered is not being updated via the Calypso software.

I manually entered a serial number "SC--0010" (Purposely entered wrong to test the code to find the invalid characters) when I check the value via PCM I get the last entered value, "SC-0009". This is causing the code to skip past the new invalid entry.

Where is the logic wrong?

Or how do I pass the new value to Calypso, because "setRecordHead("u_partnbinc", sernotest)" is not working. (I use partbinc for serial numbers and a numeric counter).

The code "setRecordHead" is not passing/setting any of the values to the corresponding Calypso dialog boxes.

The code below is in the PCM Pre-Settings.

NOT_ALLOWED_LIST = list("~", "`", "!", "@", "$", "%", "^", "&", "*", "(", ")", "+", "=", "{", "}", "[", "]", "|", ":", ";", "'", "<", ">", ".", ".", "/", "\", "?", "--", "__")
NOT_ALLOWED_LIST_NAME = "NOT_ALLOWED_LIST"

//Begin Serial Number or Incremental Counter validation
// Initial input
sernotest = getRecordHead("u_partnbinc")
sernotest2 = getRecordHead("u_partnbinc")
repeat
    invalid_found = false

    for not_allowed_index = 1 to NOT_ALLOWED_LIST.size
        this_not_allowed_str = getParameterNamed(NOT_ALLOWED_LIST_NAME, not_allowed_index)
        attempt = inStr(sernotest, this_not_allowed_str)

        if attempt <> 0 then
            message("Invalid character '" + this_not_allowed_str + "' found in input '" + sernotest + "'. Please re-enter a valid value.")
            sernotest = inquireText("Please enter the correct ""Serial Number or numeric counter value"".")
            setRecordHead("u_partnbinc_Corrected", sernotest)
            invalid_found = true
            not_allowed_index = NOT_ALLOWED_LIST.size + 1  // Force exit from for-loop
        endif
    next not_allowed_index

until invalid_found == false

// Only prompt again if input was corrected
if getRecordHead("u_partnbinc_Corrected") == sernotest2 then //Revised: was "if getRecordHead("u_partnbinc_Corrected") = "" then"
    sernotest = inquireText("Please enter the correct ""Serial Number or numeric counter value"".")
    setRecordHead("u_partnbinc", sernotest)
else
    setRecordHead("u_partnbinc", sernotest)
endif
//End Serial Number or Incremental Counter validation

I have also noted that entering "M000" causes the code to loop up to three times before it accepts "SC000", but if I change that value to "SC001", it works fine. 

I think its because the code is looking for "0" as false?

Printout header data dialog box.jpg

Edited
Added image
Link to comment
Share on other sites

I have noticed when I enter the Incremental Part Number value, it is not being passed to u_partnbinc.

When I start a program, all of them, "Force Input at Start" is enabled, this requires the Printout header data dialog box appears to enter data required.

I have entered 4 different values, ran the program each time, and each time the PCM code displays "SC-0009" when manually computed.

BUTT

When the reports are generated, PiWeb, Excel PDF, txt, etc, they all have the value I entered manually.

Edited
Link to comment
Share on other sites

Just adding information.

This is copied from the inspect file.

it appears to be hard. Its not changing. Every time the PCM calls for u_partnbinc, it retrieves "SC-0009".

Every

Time.

Please sign in to view this quote.

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...