pastisucess Posted January 15, 2011 Share Posted January 15, 2011 i'm newbie here, i need to know how i want make a sum with same word . example : i have 2 serial number JAE11111111(P) and JAE22222222(F). my project here how i want make a yields refer from the serial number. Total Test = 2 total Pass = 1 total fail = 1 yields = ? regards pastisucess http://asiavacationpackages.blogspot.com Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 15, 2011 Share Posted January 15, 2011 (edited) You can test the strings with things like this: Global $iTotal = 0, $iPass = 0, $iFail = 0 Global $aInputs[6] = ["JAE11111111(P)", "JAE22222222(F)", "JAE12345678(P)", "JAE87654321(F)", "JAE02468024(P)", "JAE13579135(P)"] For $n = 0 To UBound($aInputs) - 1 $iTotal += 1 Select Case StringInStr($aInputs[$n], "(P)") $iPass += 1 Case StringInStr($aInputs[$n], "(F)") $iFail += 1 EndSelect Next MsgBox(64, "Results", "Total Count = " & $iTotal & @CRLF & _ "Passed = " & $iPass & @CRLF & _ "Failed = " & $iFail) Here, the inputs are just strings in an array, and the totals are generated by just looping through the array. I have no idea what you mean by "Yields", and just assumed "(P)" or "(F)" are the only indicator of pass/fail. You might also put it in a function and call it as required, this way: Global $iTotal = 0, $iPass = 0, $iFail = 0 Global $aInputs[6] = ["JAE11111111(P)", "JAE22222222(F)", "JAE12345678(P)", "JAE87654321(F)", "JAE02468024(P)", "JAE13579135(P)"] For $n = 0 To UBound($aInputs) - 1 _CheckItem($aInputs[$n]) Next MsgBox(64, "Results", "Total Count = " & $iTotal & @CRLF & _ "Passed = " & $iPass & @CRLF & _ "Failed = " & $iFail) Func _CheckItem($sInput) $iTotal += 1 Select Case StringInStr($sInput, "(P)") $iPass += 1 Case StringInStr($sInput, "(F)") $iFail += 1 EndSelect EndFunc Edited January 15, 2011 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now