[No...] Posted October 14 Share Posted October 14 Does anyone know if generateTabelColumn() is somehow able to control the position of a newly inserted column? (for example, insert as 15th column from the left) We want to import such a table to a CAQ system, and for this we need to order a custom import module. Now the manufacturer requests example files and I'm not even sure if the file I provide today will always look the same in the future, because I can't control where generateTable Column() puts a new column. Of course they could make the import module search for the column name first, but this would make it more complex, as in "more expensive". Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/ Share on other sites More sharing options...
[Mi...] Posted October 15 Share Posted October 15 Hello Norbert, unfortunately generateTabelColumn() appends a new column only at the end. Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/#findComment-156952 Share on other sites More sharing options...
[No...] Posted October 15 Author Share Posted October 15 I feared as much. Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/#findComment-156960 Share on other sites More sharing options...
[Jü...] Posted yesterday at 12:56 PM Share Posted yesterday at 12:56 PM Hallo Norbert, wir benutzen genau diesen Befehl für unser CAQ- System (CAQ AG). Im Importmodul haben wir die Lage der Daten in der TXT genau definieren können. Wir haben Prüfer, Auftragsnummer, Arbeitsgang, Datum und Uhrzeit mit generateTabelColumn() in die TXT geschrieben Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/#findComment-158180 Share on other sites More sharing options...
[No...] Posted yesterday at 01:41 PM Author Share Posted yesterday at 01:41 PM (edited) Please sign in to view this quote. Um mal ein Beispiel aus der Praxis zu nennen: In der stark veralteten Version unseres bestehenden CAQ-Systems, das demnächst abgelöst werden soll, gibt es eine Importmöglichkeit für eine Calypso Sammeldatei. Das Importmodul erwartet z.B. die Positionsnummer im Kommentarfeld und sucht dieses in der Tabellenspalte 14. Mittlerweile hat Zeiss aber das Tabellenformat verändert, wodurch die Kommentarspalte an die Position 15 gerückt ist. Somit konnten wir dann diese Importmöglichkeit für Calypso nicht mehr nutzen (es gab aber zum Glück noch eine zweite für das Kompaktprotokoll). Einstellbar war da leider nichts. Und genau so einen Fall möchte ich beim Umstieg auf das neue System vermeiden, zumal wir hier das Importmodul auch noch kundenspezifisch programmieren lassen müssen. Also brauche ich entweder die Möglichkeit, die Position einer zusätzlichen Tabellenspalte selber in Calypso festzulegen, oder das Importmodul muss konfigurerbar sein. Aber jeder zusätzliche Wunsch kostet hier natürlich auch zusätzliches Geld. Darum würde ich die PCM-Variante bevorzugen. Edited yesterday at 01:43 PM Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/#findComment-158184 Share on other sites More sharing options...
[Mi...] Posted 8 hours ago Share Posted 8 hours ago du kannst probieren, den folgenden Code für deinen Bedarf anzupassen und ihn in die "inspection_end_pcm.txt" packen. Dieser liest die Datei "fileIn" ein, setzt die Spalte "posHeaderIn" auf die Position "posHeaderOut" und gibt die Daten wieder in der Datei "fileOut" aus. Ich habe es bei mir nur an einer Besipiel-Datei getestet. posHeaderIn=5 // position in originary file posHeaderOut=2 // new position fileIn=directoryPath("results") + "\test_chr.txt" // input file fileOut=directoryPath("results") + "\test_out.txt" // output file if fileExists(fileOut)==true deleteFile(fileOut) endif //--------------------------------------------------------------------------------------------------------------------- defineFunctionStart("SortList") strSorted= "list(" for k=1 to subStr.size selectCase k case posHeaderIn strSorted= strSorted case posHeaderOut strSorted= strSorted + qm() + getParameterNamed(subStr,posHeaderIn)+ qm() + "," strSorted= strSorted + qm() + getParameterNamed(subStr,k)+ qm() + "," caseElse strSorted= strSorted + qm() + getParameterNamed(subStr,k)+ qm() + "," endSelect next k ANZ=len(strSorted) ANZ=ANZ-1 strSorted=mid(strSorted,1,ANZ) strSorted= strSorted + ")" strSorted=getParameterNamed(strSorted) defineFunctionEnd("strSorted") defineFunctionStart("WriteLine") outStr="" for k=1 to subStr.size outStr=outStr + chr(9) + getParameterNamed(subStr,k) next k outStr=outStr.killWhiteSpaces addToFile(fileOut,outStr) defineFunctionEnd("0") //--------------------------------------------------------------------------------------------------------------------- // header fileIn=fileIn.asFilename.contentsAsLines headerLine=getParameterNamed(fileIn,1) header = "list(" j=1 repeat // chr(9) ist ASCII-Code für Tab als Leerzeichen strCheck=strElement(j,chr(9),headerLine).trimBlanks if not(strCheck.isEmpty) header= header + qm() + strCheck + qm() + "," endif j=j+1 until strCheck.isEmpty==true // leerer Eintrag am Ende, der zu nil führt, entfernen ANZ=len(header) ANZ=ANZ-1 header=mid(header,1,ANZ) header= header + ")" header=getParameterNamed(header) subStr=header subStr=executeFunctionNamed("SortList") executeFunctionNamed("WriteLine") //--------------------------------------------------------------------------------------------------------------------- // values for i=2 to fileIn.size line1= getParameterNamed(fileIn,i) subStr = "list(" for j =1 to header.size // chr(9) ist ASCII-Code für Tab als Leerzeichen strCheck=strElement(j,chr(9),line1) subStr= subStr + qm() + strCheck + qm() + "," next j // leerer Eintrag am Ende, der zu nil führt, entfernen ANZ=len(subStr) ANZ=ANZ-1 subStr=mid(subStr,1,ANZ) subStr= subStr + ")" subStr=getParameterNamed(subStr) subStr=executeFunctionNamed("SortList") executeFunctionNamed("WriteLine") next i 1 Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/#findComment-158256 Share on other sites More sharing options...
[He...] Posted 1 hour ago Share Posted 1 hour ago Please sign in to view this quote. I don't think it would cost that much to have it look through the headerline and find the position of each wanted collumn. It takes me about 15 minutes writing and testing the code in PCM and it should take an experienced developer way less than that using a capable language. Link to comment https://qualityforum.zeiss.com/topic/27650-generate-table-column-at-fixed-position/#findComment-158298 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