[Ri...] Posted October 31 Share Posted October 31 (edited) 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? Edited October 31 Added image Link to comment Share on other sites More sharing options...
[Ri...] Posted October 31 Author Share Posted October 31 Its crazy, I wrote in this post that the code was working, and now its ignoring nearly everything. Link to comment Share on other sites More sharing options...
[Ri...] Posted October 31 Author Share Posted October 31 (edited) 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 October 31 Link to comment Share on other sites More sharing options...
[Ri...] Posted October 31 Author Share Posted October 31 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 More sharing options...
[No...] Posted November 3 Share Posted November 3 I don't know if this will help you in any way, but many years ago I encountered a strange problem with header variables changing to old content when modifying programs on different Calypso computers. We (manually) append an index string with a counter to the part name when we make changes to the number or order of characteristics in a program. We do this in order to create a new data set in the QDAS database, because it uses that header field to determine which data set to write results to. What I encountered was that sometimes the content of the part name field reverted back to an old state, resulting in the data being written to the wrong data set. After a long time of research I found out that this has to do with the contents of the protheadpara file. The rule goes like this: If a program is loaded and no protheadpara file exists yet, Calypso reads the header fields from the inspection file and writes them to a newly created protheadpara file. If however a program is loaded when a protheadpara already exists, the protheadpara contents override those read from the inspection file. If the program is then resaved afterwards, the data read from the protheadpara gets written to the inspection file. That was how old data from another computer could make it into the inspection file and from there to other computers. My solution was to write a batch file that is run every time a program is loaded, deleting each and every protheadpara file in all subdirectories, so they can no longer interfere with the "inspection" data. So maybe you want to try what happens if you delete the protheadpara file at certain places in your code, or at least repeatedly monitor its contents and see when and how it changes while your code is manipulating the data. I wouldn't be surprised if it would also play a role in your issues 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in