[Ri...] Posted January 10, 2020 Share Posted January 10, 2020 I am creating a program for 8 part families with 15 part numbers per family. I would like to have a confirmation show up before the measurement launches to have the operator make sure the correct family and part number were selected. I'm having trouble getting either the syntax or order of events sorted out. Any suggestions? Link to comment Share on other sites More sharing options...
[Er...] Posted January 10, 2020 Share Posted January 10, 2020 It would be easier to push you forward if we know what approach you've already gone for. But generally, you probobilly have stored selected "families" and and "part number" in a varaible. Once both are defined, make simple dialog to confim, have the whole selection part in a repeat loop until confirmation is true. psuedo code: repeat chose family chose part are you shure until are you sure == true Link to comment Share on other sites More sharing options...
[Ri...] Posted January 10, 2020 Author Share Posted January 10, 2020 Eric, you are correct. I have the families first and variants next. I will give repeat until a go and report back. Link to comment Share on other sites More sharing options...
[Cl...] Posted January 10, 2020 Share Posted January 10, 2020 Mind you I'm a PCM novice, but would this work? Not sure about how to do the confirm? Just trying get involved in PCM discussion in hopes of learning more. Part_Family = inquireList("Which part family would you like to run?", "12345_A", "12345_B") selectCase Part_Family case "12345_A" case "12345_B" Part_Number = inquireList("Which part number would you like to run?", "MXXX-01", "MXXX-02") selectCase Part_Number case "MXXX-01" case "MXXX-02" Link to comment Share on other sites More sharing options...
[Er...] Posted January 10, 2020 Share Posted January 10, 2020 Since we are talking about 120 different alternatives, Its less work to store all the options in a array. Then use a for-loop and build your inquires that way. Link to comment Share on other sites More sharing options...
[No...] Posted January 13, 2020 Share Posted January 13, 2020 Please sign in to view this quote. Clarke, with so many variants, you need to 'filter' the options, which means that after selecting the part family, only the 15 part numbers belonging to that family are to be presented for selection. If you'd write all this in "clear text" like in your example, it would result in a huge and nearly unmanageable jungle of PCM statements. By working with arrays you only need to write the 'skeltal structure' of those statements once, because you can then use variables to determine which array elements to access.That way your code stays small and simple. Link to comment Share on other sites More sharing options...
[Ri...] Posted January 13, 2020 Author Share Posted January 13, 2020 Clarke, I got it all sorted out well enough to suit my needs. I start out with asking the operator to select a Part Family. PF=inquireList("Part Family","722-140XX","722-145XX","722-240XX","722-245XX","722-340XX","722-345XX","722-440XX","722-445XX") Then I start a Repeat statement. repeat Now comes the specific Part Number within the Part Family if PF=="722-140XX" PN=inquireList("Part Number","722-14010","722-14011","722-14012","722-14013","722-14014","722-14015","722-14016","722-14017","722-14018","722-14019","722-14020","722-14021","722-14022","722-14023","722-14024") endif if PF=="722-145XX" PN=inquireList("Part Number","722-14510","722-14511","722-14512","722-14513","722-14514","722-14515","722-14516","722-14517","722-14518","14519","14520","722-14521","722-14522","722-14523","722-14524") endif if PF=="722-240XX" PN=inquireList("Part Number","722-24010","722-24011","722-24012","722-24013","722-24014","722-24015","722-24016","722-24017","722-24018","722-24019","722-24020","722-24021","722-24022","722-24023","722-24024") endif if PF=="722-245XX" PN=inquireList("Part Number","722-24510","722-24511","722-24512","722-24513","722-24514","722-24515","722-24516","722-24517","722-24518","722-24519","722-24520","722-24521","722-24522","722-24523","722-24524") endif if PF=="722-340XX" PN=inquireList("Part Number","722-34010","722-34011","722-34012","722-34013","722-34014","722-34015","722-34016","722-34017","722-34018","722-34019","722-34020","722-34021","722-34022","722-34023","722-34024") endif if PF=="722-345XX" PN=inquireList("Part Number","722-34510","722-34511","722-34512","722-34513","722-34514","722-34515","722-34516","722-34517","722-34518","722-34519","722-34520","722-34521","722-34522","722-34523","722-34524") endif if PF=="722-440XX" PN=inquireList("Part Number","722-44010","722-44011","722-44012","722-44013","722-44014","722-44015","722-44016","722-44017","722-44018","722-44019","722-44020","722-44021","722-44022","722-44023","722-44024") endif if PF=="722-445XX" PN=inquireList("Part Number","722-44510","722-44511","722-44512","722-44513","722-44514","722-44515","722-44516","722-44517","722-44518","722-44519","722-44520","722-44521","722-44522","722-44523","722-44524") endif Once that get's done now I create a variable called conf and use the confirm command to give it a value. conf=(confirm("You have selected",PN," Is that the correct Part Number?")) and end the repeat/until by asking for the conf variable to be True until conf==True Link to comment Share on other sites More sharing options...
[Cl...] Posted January 13, 2020 Share Posted January 13, 2020 Glad you got it worked out. I enjoy these kind of discussions, especially PCM. I'm learning a lot! Link to comment Share on other sites More sharing options...
[No...] Posted January 14, 2020 Share Posted January 14, 2020 Please sign in to view this quote. I see, you prefer the 'jungle' method too 😉 😃 [/quote] Link to comment Share on other sites More sharing options...
[Ri...] Posted January 14, 2020 Author Share Posted January 14, 2020 Norbert, Brute force rarely disappoints. Link to comment Share on other sites More sharing options...
[Er...] Posted January 14, 2020 Share Posted January 14, 2020 Omfg, you sir deserve a medal of patience for hard coding all of that! Glad you worked it out though. Link to comment Share on other sites More sharing options...
[Ri...] Posted January 15, 2020 Author Share Posted January 15, 2020 Eric, thanks for the Medal of Patience. It wasn't so bad really given my Neanderthal coding skills. Copy and Paste are essential tools. Get a section looking the way it needs to then Copy and Paste and edit what needs editing. Link to comment Share on other sites More sharing options...
[No...] Posted January 16, 2020 Share Posted January 16, 2020 Please sign in to view this quote. Yes, but only if you live to see the result 🤣 But congrats from me too! Link to comment Share on other sites More sharing options...
[Er...] Posted January 16, 2020 Share Posted January 16, 2020 Since you put in the work and did'nt excpect anyone else to do it for you. For future reference, you can do something like this, it only takes ~4 minutes and is a lot less keyboard punching. And we "youngsters" wont call you a dinosaur... 😃 repeat famChoise=inquireList("Choose your part:", "722-140XX","722-145XX","722-240XX","722-245XX","722-340XX","722-345XX","722-440XX","722-445XX") part="" for i = 10 to 24 part=part+","+qm()+subStr(famChoise,1,7)+i+qm() next i until confirm("Sure you choise are correct?"+cr()+"Part Famly: "+famChoise+cr()+"Part no: "+compute("inquireList("+qm()+"Choose par no: "+qm()+","+subStr(part,2,part.size)+")")) == true Link to comment Share on other sites More sharing options...
[To...] Posted January 20, 2020 Share Posted January 20, 2020 Please sign in to view this quote. 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