cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-345121%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3Erenommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345121%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EBonjour%2C%3C%2FP%3E%3CP%3EJe%20suis%20novice%20en%20JSL%2C%20alors%20appr%C3%A9ciez%20votre%20aide.%3CBR%20%2F%3E%20J'ai%20trois%20fichiers.%3C%2FP%3E%3CP%3Efichier%20%231%20%3A%20C'est%20le%20fichier%20de%20r%C3%A9f%C3%A9rence%2C%20%5Bcomme%20ref.csv%5D%20contenant%203%20colonnes%20comme%20ci-dessous.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECat%C3%A9gorie%2C%20largeur%2C%20%C3%A9tiquette%3CBR%20%2F%3E%20--------------------------------%3CBR%20%2F%3E%20A%2C0%2CL1.abc%3CBR%20%2F%3E%20A%2C1%2CL2.xt%3CBR%20%2F%3E%20A%2C2%2CL8.dr%3CBR%20%2F%3E%20A%2C3%2CL20.ws%3CBR%20%2F%3E%20A%2C4%2CL72.oz%3CBR%20%2F%3E%20B%2C0%2CL11.qq%3CBR%20%2F%3E%20....%3CBR%20%2F%3E%20B%2C6%2CL61.er%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Efichier%20n%C2%B02%26nbsp%3B%3A%20fichier%20de%20donn%C3%A9es%20n%C2%B01%20dans%20JMP%2C%20contenant%20la%20cat%C3%A9gorie%2C%20les%20donn%C3%A9es%20et%20de%20nombreuses%20autres%20colonnes.%3CBR%20%2F%3E%20fichier%20%233%20%3A%20fichier%20de%20donn%C3%A9es%20%232%20dans%20JMP%2C%20contenant%20Category%2C%20Data%20et%20de%20nombreuses%20autres%20colonnes.%3CBR%20%2F%3E%20la%20diff%C3%A9rence%20entre%20les%20deux%20fichiers%20de%20donn%C3%A9es%20%5BFichier%20%232%20et%20fichier%20%233%5D%20est%20le%20type%20de%20cat%C3%A9gorie%20et%20la%20largeur%20de%20la%20valeur%20dans%20la%20colonne%20de%20donn%C3%A9es.%3C%2FP%3E%3CP%3EFichier%20de%20donn%C3%A9es%20%231%26nbsp%3B%3A%3C%2FP%3E%3CP%3ECat%C3%A9gorie%7Cdonn%C3%A9es%7Cnombreux%20cols.....%3CBR%20%2F%3E%20----------------------------------------%3CBR%20%2F%3E%20A%20123.23%20....%3CBR%20%2F%3E%20A%20321.45....%3CBR%20%2F%3E%20.....%3CBR%20%2F%3E%20plusieurs%20rang%C3%A9es%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ela%20largeur%20des%20valeurs%20dans%20la%20colonne%20%22donn%C3%A9es%22%20%5B%C3%A0%20l'exclusion%20des%20points%5D%20correspond%20au%20nombre%20de%20lignes%20dans%20le%20fichier%26nbsp%3B%231%20pour%20une%20cat%C3%A9gorie%20donn%C3%A9e%3CBR%20%2F%3E%20exemple%3A%3CBR%20%2F%3E%20la%20largeur%20de%20123%2C23%20dans%20la%20ligne%201%20du%20fichier%20de%20donn%C3%A9es%20n%C2%B0%201%20est%20de%205.%3CBR%20%2F%3E%20le%20nombre%20de%20lignes%20dans%20le%20fichier%20de%20r%C3%A9f%C3%A9rence%20pour%20la%20cat%C3%A9gorie%20A%20serait%20de%205.%20cela%20n'a%20pas%20besoin%20d'%C3%AAtre%20test%C3%A9%20%C3%A0%20proprement%20parler.%20c'est%20ainsi%20que%20les%20tables%20arrivent%20%5Bc'est-%C3%A0-dire%20lorsqu'elles%20sont%20extraites%20de%20la%20source%5D%3C%2FP%3E%3CP%3E%C3%80%20l'avenir%2C%20dans%20le%20fichier%20de%20r%C3%A9f%C3%A9rence%2C%20par%20exemple%20pour%20la%20cat%C3%A9gorie%20A%2C%20le%20nombre%20de%20lignes%20augmente%20%C3%A0%206%20ou%20plus%2C%20la%20largeur%20de%20la%20valeur%20contenue%20dans%20la%20colonne%20de%20donn%C3%A9es%20du%20fichier%20de%20donn%C3%A9es%20de%20fichier%20%231%20augmentera%20%C3%A9galement%20lorsque%20les%20informations%20sont%20extraites%20de%20la%20base%20de%20donn%C3%A9es.%3C%2FP%3E%3CP%3EFichier%20de%20donn%C3%A9es%20%232%26nbsp%3B%3A%3C%2FP%3E%3CP%3ECat%C3%A9gorie%7Cdonn%C3%A9es%7Cnombreux%20cols.....%3C%2FP%3E%3CP%3E----------------------------------------%3CBR%20%2F%3E%20B%201236.23%20....%3CBR%20%2F%3E%20B%203213.45%20....%3CBR%20%2F%3E%20.....%3CBR%20%2F%3E%20plusieurs%20rang%C3%A9es%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EObjectif%201%26nbsp%3B%3A%26nbsp%3Bcr%C3%A9er%20de%20nouvelles%20colonnes%20en%20fonction%20de%20la%20largeur%20de%20la%20valeur%20contenue%20dans%20la%20colonne%20%22donn%C3%A9es%22%20du%20fichier%20de%20donn%C3%A9es%20n%C2%B0%26nbsp%3B1%20%5Bet%20d'autres%20fichiers%20de%20donn%C3%A9es%5D%3CBR%20%2F%3E%20J'en%20ai%20fini%20avec%20l'objectif%20%231%20!%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Eex%3A%3CBR%20%2F%3E%20le%20fichier%20de%20donn%C3%A9es%20mis%20%C3%A0%20jour%20%231%20ressemblerait%20%C3%A0%20ceci%26nbsp%3B%3A%3CBR%20%2F%3E%20Cat%C3%A9gorie%7Cdonn%C3%A9es%7Cc1%7Cc2%7Cc3%7Cc4%7Cc5%7Cnombreux%20cols.....%3CBR%20%2F%3E%20----------------------------------------%3CBR%20%2F%3E%20A%20123.23%201%202%203%202%203%20....%3CBR%20%2F%3E%20A%20321.45%203%202%201%204%205%20....%3CBR%20%2F%3E%20.....%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Eobjectif%202%20%3A%20renommer%20les%20nouvelles%20colonnes%20du%20fichier%20de%20donn%C3%A9es%20%231%20%5Bc'est-%C3%A0-dire%20c1%20%C3%A0%20c5%5D%20en%20L1...%20en%20L72...%20comme%20d%C3%A9fini%20dans%20la%20colonne%20%22label%22%20du%20fichier%20de%20r%C3%A9f%C3%A9rence.%20aucun%20changement%20dans%20les%20valeurs%20des%20cellules%2C%20il%20suffit%20de%20mettre%20%C3%A0%20jour%20les%20noms%20de%20col%20s%C3%A9lectionn%C3%A9s.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Er%C3%A9sultat%20attendu%20une%20fois%20l'objectif%202%20atteint%26nbsp%3B%3A%3CBR%20%2F%3E%20Mettez%20%C3%A0%20jour%20le%20fichier%20de%20donn%C3%A9es%20%231%20pour%20qu'il%20ressemble%20%C3%A0%20ceci%26nbsp%3B%3A%3CBR%20%2F%3E%20Cat%C3%A9gorie%7Cdonn%C3%A9es%7CL1.abc%7CL2.xt%7CL8.dr%7CL20.ws%7CL72.oz%7Cbeaucoup%20de%20cols.....%3CBR%20%2F%3E%20----------------------------------------%3CBR%20%2F%3E%20A%20123.23%201%202%203%202%203%20....%3CBR%20%2F%3E%20A%20321.45%203%202%201%204%205%20....%3CBR%20%2F%3E%20.....%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EJ'ai%20besoin%20d'aide%20pour%20l'objectif%20n%C2%B0%26nbsp%3B2.%3C%2FP%3E%3CP%3EPour%20l'objectif%20n%C2%B02%20j'ai%20ouvert%20le%20fichier%20de%20r%C3%A9f%C3%A9rence%20mais%20pas%20s%C3%BBr%20d'avancer.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMerci%3CBR%20%2F%3E%20David%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-345121%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EAcc%C3%A8s%20aux%20donn%C3%A9es%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPersonnalisation%20de%20masse%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345254%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345254%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EOK%20.....%20c'est%20un%20peu%20pointilleux%20.....%20mais%20ce%20qui%20se%20trouve%20dans%20dataTablesList%20n'est%20pas%20une%20liste%20de%20noms%20de%20tables%20de%20donn%C3%A9es%20mais%20des%20fonctions%20data%20table%20()%2C%20qui%20pointent%20vers%20des%20tables%20de%20donn%C3%A9es.%3CBR%20%2F%3E%20%7B%22Table1%22%2C%22Table2%22%7D%20%2F%2F%20Une%20liste%20de%20noms%20de%20tables%20de%20donn%C3%A9es%3CBR%20%2F%3E%20%7B%20data%20table(%20%22Table1%22%20)%2C%20data%20table(%20%22Table2%22%20)%20%7D%20%2F%2F%20une%20liste%20de%20pointeurs%20vers%20des%20tables%20de%20donn%C3%A9es%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345249%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345249%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3Eouais.%20j'ai%20compris.%20contient%20le%20nom%20de%20la%20table%20de%20donn%C3%A9es%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-David%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345248%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345248%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EdataTableList%20ne%20contient%20pas%20les%20tables%20de%20donn%C3%A9es%2C%20il%20ne%20contient%20que%20des%20pointeurs%20vers%20les%20tables.%20Cr%C3%A9er%20la%20liste%20puis%20ex%C3%A9cuter%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EShow(%20dataTableList%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eet%20vous%20verrez%20ce%20qui%20est%20dans%20la%20liste.%3CBR%20%2F%3E%20Vous%20pouvez%20%C3%A9galement%20voir%20ce%20qui%20est%20dans%20la%20liste%2C%20en%20passant%20simplement%20votre%20souris%20sur%20la%20variable%2C%20et%20il%20affichera%20sa%20valeur%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345245%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345245%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci%20Jim.%20Avec%20des%20modifications%20mineures%20%5B%C3%A0%20mes%20besoins%5D%20%C3%A7a%20marche%20!%20Merci%20!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuestion%2C%20la%20liste%20%5BdatatableList%5D%20peut-elle%20contenir%20beaucoup%20d'informations%26nbsp%3B%3F%3C%2FP%3E%3CP%3EChacune%20de%20mes%20tables%20a%20beaucoup%20de%20lignes%20comme%20des%20milliers%20et%20a%20%C3%A9galement%20de%20nombreuses%20colonnes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-David%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345220%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345220%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ED%C3%A9sol%C3%A9%20pour%20ma%20d%C3%A9sinformation.J'ai%20mal%20interpr%C3%A9t%C3%A9%20la%20structure%20de%20la%20table%20de%20donn%C3%A9es%20Cat%C3%A9gories.Vous%20trouverez%20ci-dessous%20un%20script%20qui%20cr%C3%A9e%20quelques%20tables%20de%20donn%C3%A9es%20et%20une%20table%20de%20cat%C3%A9gories%2C%20puis%20d%C3%A9veloppe%20les%20tables%20de%20donn%C3%A9es%20et%20renomme%20enfin%20les%20colonnes%20en%20fonction%20des%20entr%C3%A9es%20de%20la%20table%20de%20donn%C3%A9es%20des%20cat%C3%A9gories.J'esp%C3%A8re%20que%20cela%20nous%20remettra%20sur%20la%20bonne%20voie.Le%20script%20fonctionnera%20sur%20autant%20de%20tables%20de%20donn%C3%A9es%20que%20n%C3%A9cessaire.Il%20suffit%20d'ajouter%20%C3%A0%20la%20liste%20dataTableList%2C%20toutes%20les%20tables%20de%20donn%C3%A9es%20%C3%A0%20traiter%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0A%2F%2F%20This%20example%20script%20opens%20up%202%20data%20tables%20and%201%20category%20table.%20%20%0A%2F%2F%20In%20reality%2C%20as%20many%20as%20necessary%20data%20tables%20could%20be%20used%0A%0A%2F%2F%20Create%20the%20tables%0Adt1%20%3D%20New%20Table(%20%22Table1%22%2C%0A%20Add%20Rows(%203%20)%2C%0A%20New%20Column(%20%22Category%22%2C%20Character%2C%20%22Nominal%22%2C%20Set%20Values(%20%7B%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%7D%20)%20)%2C%0A%20New%20Column(%20%22DATA%22%2C%20Character(%2033%20)%2C%20%22Nominal%22%2C%20Set%20Values(%20%7B%22123.56.8.342%22%2C%20%22431.02.0.567%22%2C%20%22318.00.1.816%22%7D%20)%2C%20Set%20Display%20Width(%20182%20)%20)%0A)%3B%0Adt2%20%3D%20New%20Table(%20%22Table2%22%2C%0A%20Add%20Rows(%203%20)%2C%0A%20New%20Column(%20%22Category%22%2C%20Character%2C%20%22Nominal%22%2C%20Set%20Values(%20%7B%22B%22%2C%20%22B%22%2C%20%22B%22%7D%20)%20)%2C%0A%20New%20Column(%20%22Data%22%2C%20Character%2C%20%22Nominal%22%2C%20Set%20Values(%20%7B%2213.24%22%2C%20%2298.44%22%2C%20%2263.89%22%7D%20)%20)%0A)%3B%0AdtCat%20%3D%20New%20Table(%20%22The%20Categories%22%2C%0A%20Add%20Rows(%2013%20)%2C%0A%20New%20Column(%20%22Category%22%2C%0A%20%20Character%2C%0A%20%20%22Nominal%22%2C%0A%20%20Set%20Values(%20%7B%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22ABC%22%2C%20%22B%22%2C%20%22B%22%2C%20%22B%22%2C%20%22B%22%7D%20)%2C%0A%20%20Set%20Display%20Width(%2067%20)%0A%20)%2C%0A%20New%20Column(%20%22Width%22%2C%20Numeric%2C%20%22Continuous%22%2C%20Format(%20%22Best%22%2C%2012%20)%2C%20Set%20Values(%20%5B0%2C%201%2C%202%2C%203%2C%204%2C%205%2C%206%2C%207%2C%208%2C%200%2C%201%2C%202%2C%203%5D%20)%20)%2C%0A%20New%20Column(%20%22Label%22%2C%0A%20%20Character(%2016%20)%2C%0A%20%20%22Nominal%22%2C%0A%20%20Set%20Values(%0A%20%20%20%7B%22label0.0%22%2C%20%22label0.1%22%2C%20%22label0.2%22%2C%20%22label0.3%22%2C%20%22label0.4%22%2C%20%22label0.5%22%2C%20%22label0.6%22%2C%20%22label0.7%22%2C%20%22label0.8%22%2C%20%22thelabel.1%22%2C%20%22thelabel.2%22%2C%0A%20%20%20%22thelabel.3%22%2C%20%22thelabel.4%22%7D%0A%20%20)%2C%0A%20%20Set%20Display%20Width(%2099%20)%0A%20)%0A)%3B%0A%0A%2F%2F%20Below%20this%20line%2C%20is%20the%20script%20that%20will%20add%20the%20new%20columns%20to%20each%20of%20the%20data%20tables%0A%2F%2F%20and%20will%20take%20the%20names%20from%20the%20dtCat%20(Categories)%20data%20table%20and%20change%20the%20names%20to%0A%2F%2F%20the%20columns%20in%20each%20of%20the%20data%20tables%0A%0A%2F%2F%20Create%20a%20list%20of%20the%20pointers%20to%20the%20data%20tables.%20%20This%20will%20allow%20for%20the%20using%20of%20the%20list%20%0A%2F%2F%20entries%20to%20point%20to%20the%20data%20tables%20using%20a%20subscript%20%0AdataTableList%20%3D%20%7B%7D%3B%0Ainsert%20into(dataTableList%2C%20dt1%20)%3B%0Ainsert%20into(dataTableList%2C%20dt2%20)%3B%0A%0A%2F%2F%20Loop%20across%20the%20data%20table%20list%20and%20expand%20the%20columns%20based%20upon%20the%20the%20column%20called%20Data%0AFor(%20i%20%3D%201%2C%20i%20%26lt%3B%3D%20N%20Items(%20dataTableList%20)%2C%20i%2B%2B%2C%0A%20ncols_to_add%20%3D%20length(%20substitute((dataTableList%5Bi%5D%3AData)%5B1%5D%2C%22.%22%2C%22%22))%3B%0A%20For(%20k%20%3D%201%2C%20k%20%26lt%3B%3D%20ncols_to_add%2C%20k%2B%2B%2C%20%2F%2F%20the%20%7C%7C%20operator%20joins%20two%20strings%0A%20%20dataTableList%5Bi%5D%20%26lt%3B%26lt%3B%20New%20Column(%20%22c%22%20%7C%7C%20Char(%20i%20)%2C%0A%20%20%20Numeric%2C%0A%20%20%20Continous%2C%0A%20%20%20%26lt%3B%3CSET%20each%3D%22%22%20value%3D%22%22%3E%3C%2FSET%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345215%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345215%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJim%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPour%20l'%C3%A9tape%202%20avec%20les%20modifications%20ci-dessous%20%5Billustr%C3%A9es%20ci-dessous%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2B%2B%2B%2B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ec'est%20ma%20ref.csv%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ecat%C3%A9gorie%7Clargeur%7C%C3%A9tiquette%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EABC%200%20%C3%A9tiquette0.0%3CBR%20%2F%3E%20Etiquette%20ABC%2010.1%3CBR%20%2F%3E%20Etiquette%20ABC%2020.2%3CBR%20%2F%3E%20Etiquette%20ABC%2030.3%3CBR%20%2F%3E%20Etiquette%20ABC%2040.4%3CBR%20%2F%3E%20Etiquette%20ABC%2050.5%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%2060.6%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%2070.7%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%2080.8%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%2090.9%3CBR%20%2F%3E%20Etiquette%20ABC%20100.10%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%20110.11%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%20120.12%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%20130.13%3CBR%20%2F%3E%20Etiquette%20ABC%20140.14%3CBR%20%2F%3E%20Etiquette%20ABC%20151.15%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%20160.16%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%20170.17%3CBR%20%2F%3E%20Etiquette%20ABC%20180.18%3CBR%20%2F%3E%20%C3%89tiquette%20ABC%20190.19%3CBR%20%2F%3E%20Etiquette%20ABC%20200.20%3CBR%20%2F%3E%20B%200%20%C3%A9tiquette11.22%3CBR%20%2F%3E%20C%201%20%C3%A9tiquette11.21%3CBR%20%2F%3E%20Etiquette%20D%20211.23%3CBR%20%2F%3E%20Etiquette%20E%20011.24%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EMon%20code%26nbsp%3B%3A%3C%2FP%3E%3CP%3Edt_ref%20%3D%20Ouvrir%20(%22ref.csv%22)%3B%3C%2FP%3E%3CP%3EFor(%20i%3D1%2C%20i%26lt%3B%3D%20N%20Rows(%20dt_ref%20)%2C%20i%2B%2B%2C%3CBR%20%2F%3E%20ins%C3%A9rer%20dans(Category_List%2C%20word(1%2C%3Alabel%5Bi%5D%2C%22%22.%22)%20%7C%7C%20%22.%22%20%7C%7C%20word(2%2C%3Alabel%5Bi%5D%2C%20%22.%22%20)%20)%3B%3CBR%20%2F%3E%20)%3B%3CBR%20%2F%3E%20show(Category_List)%3B%3C%2FP%3E%3CP%3E%2B%2B%2B%3C%2FP%3E%3CP%3EJ'obtiens%20ce%20qui%20suit%20sur%20le%20journal%3A%3C%2FP%3E%3CP%3ECategory_List%20%3D%20%7B%22%C3%A9tiquette0.0%22%2C%20%22%C3%A9tiquette0.1%22%2C%20%22%C3%A9tiquette0.2%22%2C%20%22%C3%A9tiquette0.3%22%2C%20%22%C3%A9tiquette0.4%22%2C%20%22%C3%A9tiquette0.5%22%2C%20%22%C3%A9tiquette0.6%22%2C%20%22%C3%A9tiquette0.7%22%20%2C%20%22%C3%A9tiquette0.8%22%2C%20%22%C3%A9tiquette0.9%22%2C%20%22%C3%A9tiquette0.10%22%2C%20%22%C3%A9tiquette0.11%22%2C%20%22%C3%A9tiquette0.12%22%2C%20%22%C3%A9tiquette0.13%22%2C%20%22%C3%A9tiquette0.14%22%2C%20%22%C3%A9tiquette1.15%22%2C%20%22%20%C3%A9tiquette0.16%22%2C%20%22%C3%A9tiquette0.17%22%2C%20%22%C3%A9tiquette0.18%22%2C%20%22%C3%A9tiquette0.19%22%2C%20%22%C3%A9tiquette0.20%22%2C%20%22%C3%A9tiquette11.22%22%2C%20%22%C3%A9tiquette11.21%22%2C%20%22%C3%A9tiquette11.23%22%2C%20%22%C3%A9tiquette11.%2024%22%2C%20%22.%22%2C%20%22.%22%7D%26nbsp%3B%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJe%20veux%20qu'il%20s%C3%A9lectionne%20les%20%C3%A9tiquettes%20uniquement%20lorsque%20la%20cat%C3%A9gorie%20est%20ABC.%20comment%20je%20fais%20%C3%A7a%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJ'ai%20essay%C3%A9%20ce%20qui%20suit%20mais%20rien%20n'est%20renvoy%C3%A9%20pour%20la%20Category_List%26nbsp%3B%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eprod_found%20%3D%7B%22ABC%22%7D%26nbsp%3B%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Esi%20(%3Aproduct%20%3D%3D%20prod_found%2C%3CBR%20%2F%3E%20For(%20i%3D1%2C%20i%26lt%3B%3D%20N%20Rows(%20dt_ref%20)%2C%20i%2B%2B%2C%3CBR%20%2F%3E%20ins%C3%A9rer%20dans(Category_List%2C%20word(1%2C%3Aname%5Bi%5D%2C%22%22.%22)%20%7C%7C%20%22.%22%20%7C%7C%20mot(2%2C%3Anom%5Bi%5D%2C%20%22.%22%20)%20)%3B%3CBR%20%2F%3E%20)%3B%3CBR%20%2F%3E%20)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMerci%2C%3C%2FP%3E%3CP%3EDavid%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345214%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345214%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJ'ai%20regard%C3%A9%20le%20code%20que%20vous%20m'avez%20fourni..%20Il%20semble%20y%20avoir%20une%20certaine%20confusion.%3C%2FP%3E%3CP%3Ec'est%20comme%20%C3%A7a%20que%20j'ai%20intercept%C3%A9%20et%20corrigez-moi%20c'est%20faux.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Edtcat%20est%20la%20table%20de%20r%C3%A9f%C3%A9rence%20avec%20le%20nom%20col%20%5B%3CSPAN%3E%20Cat%C3%A9gorie%2C%20largeur%2C%20%C3%A9tiquette%5D.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eil%20y%20a%20plusieurs%20tables%20de%20donn%C3%A9es%20dt1%2C%20dt2%20etc%20avec%20la%20m%C3%AAme%20structure%20avec%20des%20noms%20de%20col%20%5BCat%C3%A9gorie%20%7C%20donn%C3%A9es%20%7C%20plusieurs%20cols%20.....%5D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Equand%20je%20lance%20le%20code%2C%20%C3%A7a%20ne%20fait%20rien%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Eil%20n'y%20a%20pas%20de%20colonne%20nomm%C3%A9e%20data%20dans%20la%20table%20dtcat%20et%20a%20examin%C3%A9%20le%20d%C3%A9bogage.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EVous%20vouliez%20peut-%C3%AAtre%20dire%20table%20dt1%20car%20il%20s'agit%20d'une%20colonne%20de%20donn%C3%A9es.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EJ'ai%20essay%C3%A9%20de%20jouer%20et%20%C3%A7a%20n'a%20pas%20aid%C3%A9.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EJe%20pense%20que%20nous%20sommes%20align%C3%A9s%20sur%20les%20d%C3%A9finitions%20du%20tableau%2C%20utilisez%20ce%20que%20j'ai%20d%C3%A9crit%20dans%20le%20message%20d'origine%2C%20je%20pourrais%20vous%20aider%20%C3%A0%20mon%20avis.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EEncore%20une%20fois%2C%20appr%C3%A9ciez%20l'aide%20ici.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ELaissez-moi%20la%20recommandation%20pour%20l'%C3%A9tape%202%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EMerci%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EDavid%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345213%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345213%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3COL%3E%0A%3CLI%3EVous%20indiquez%20que%20mon%20dernier%20code%20ne%20fonctionne%20pas...%20pourquoi%20pas%20%3F%3C%2FLI%3E%0A%3CLI%3EVoici%20un%20moyen%20de%20cr%C3%A9er%20la%20liste%20que%20vous%20demandez%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ECategory_List%20%3D%20%7B%7D%3B%0AFor(%20i%3D1%2C%20i%26lt%3B%3D%20N%20Rows(%20dtCat%20)%2C%20i%2B%2B%2C%0A%20%20%20%20%20insert%20into(Category_List%2C%20word(3%2C%3Adata%5Bi%5D%2C%22.%22)%20%7C%7C%20%22.%22%20%7C%7C%20word(4%2C%3Adata%5Bi%5D%2C%20%22.%22%20)%20%20)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345211%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345211%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci%20Jim.%C3%87a%20ne%20marche%20pas.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDonc%2C%20pour%20l'objectif%20n%20%C2%B0%202%2C%20j'ai%20d%C3%A9compos%C3%A9%20toute%20la%20logique%20en%20%C3%A9tapes%20de%20valeurs.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%C3%A9tape%201%3A%20r%C3%A9cup%C3%A9rez%20les%20noms%20de%20cat%C3%A9gories%20%C3%A0%20partir%20de%20la%20table%20de%20donn%C3%A9es%20%5Bdisons%20dt1%5D%20et%20stockez-les%20dans%20une%20variable%20%5Bdisons%20qu'il%20contient%20la%20cat%C3%A9gorie%20A%5D%20-%20TERMIN%C3%89%3C%2FP%3E%3CP%3Estep2%3A%20lire%20la%20variable%20de%20step1%20et%20trouver%20toutes%20les%20lignes%20qui%20correspondent%20%C3%A0%20category%20%3D%20A%5D%20obtenir%20les%20noms%20d'%C3%A9tiquettes%20de%20la%20colonne%20%22Label%22%20du%20ref.csv%2C%20%5Bque%20vous%20avez%20appel%C3%A9%20comme%20dtCat%5D%2C%20et%20le%20stocker%20dans%20une%20liste%20ou%20une%20variable.%20%5B%20dites%20qu'il%20s'appelle%20category_list%5D%3C%2FP%3E%3CP%3Edonc%20en%20utilisant%20l'exemple%20indiqu%C3%A9%20dans%20la%20discussion.%20Je%20m'attends%20%C3%A0%20ce%20que%20category_list%20contienne%20des%20valeurs%20inf%C3%A9rieures.%3C%2FP%3E%3CP%3Eliste_cat%C3%A9gorie%20%3D%3CSPAN%3E%20L1.abc%2C%3C%2FSPAN%3E%3CSPAN%3E%20L2.xt%2C%3C%2FSPAN%3E%3CSPAN%3E%20L8.dr%2C%3C%2FSPAN%3E%3CSPAN%3E%20L20.ws%2C%3C%2FSPAN%3E%3CSPAN%3E%20L72.oz%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EJe%20ne%20sais%20pas%20comment%20faire%20%C3%A7a.%20Appr%C3%A9cier%20l'aide.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%C3%A9tape%203%26nbsp%3B%3A%20V%C3%A9rifiez%20le%20nombre%20dans%20la%20liste%20%3D%3D%20non.%20de%20nouveaux%20cols%20cr%C3%A9%C3%A9s%20dans%20le%20dt1.%20c'est%20une%20chose%20suppl%C3%A9mentaire%20que%20je%20fais%20pour%20la%20robustesse.%3C%2FP%3E%3CP%3Ecompter%20dans%20category_list%20est%20de%205%20%C3%A9l%C3%A9ments%3C%2FP%3E%3CP%3Eles%20nouveaux%20cols%20cr%C3%A9%C3%A9s%20dans%20dt1%20sont%205.%20%5BJe%20l'ai%20obtenu%20de%20l'objectif%201%20car%20je%20tiens%20une%20variable%20pour%20trouver%20combien%20de%20nouveaux%20cols%20sont%20n%C3%A9cessaires%5D.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%C3%89tape%204%26nbsp%3B%3A%20remplacez%20les%20noms%20de%20cols%20dans%20dt1%20%2C%20c'est-%C3%A0-dire%20c%5Bi%5D%20par%20la%20liste%20%5Bi%5D%20en%20utilisant%20la%20boucle%20o%C3%B9%20i%20%3D%205%3C%2FP%3E%3CP%3Ec1%20remplac%C3%A9%3C%2FP%3E%3CP%3EJe%20suis%20actuellement%20%C3%A0%20l'%C3%A9tape%202%20et%20j'ai%20besoin%20d'aide.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMerci%2C%3C%2FP%3E%3CP%3EDavid%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-345159%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20renommer%20les%20noms%20de%20colonne%20dans%20un%20fichier%20jmp%20selon%20les%20valeurs%20des%20lignes%20dans%20un%20fichier%20.csv%20s%C3%A9par%C3%A9%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-345159%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EVoici%20un%20script%20non%20test%C3%A9%2C%20qui%20devrait%20%C3%AAtre%20assez%20proche%20de%20pouvoir%20atteindre%20votre%20deuxi%C3%A8me%20objectif%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EdtCat%20%3D%20Data%20Table(%20%22file%231%20name%22%20)%3B%0Adt1%20%3D%20Data%20Table(%20%22file%232%20name%22%20)%3B%0Adt2%20%3D%20Data%20Table(%20%22%20file%233%20name%22%20)%3B%0A%2F%2F%20add%20dt3%2C%20dt4%20etc.%20for%20each%20of%20the%20categories%20you%20have%0A%0A%2F%2F%20Find%20the%20number%20of%20data%20tables%20to%20process....A%20B%20C......%0A%2F%2F%20Create%20a%20temporary%20new%20column%20in%20data%20table%20dtCat%20that%20has%20just%20the%20category%0AdtCat%20%26lt%3B%26lt%3B%20New%20Column(%20%22temp%22%2C%20character%2C%20formula(%20Word(%201%2C%20%3Adata%2C%20%22.%22%20)%20)%20)%3B%0A%2F%2F%20Summarize%20the%20data%20getting%20one%20element%20in%20the%20ByGroup%20list%20for%20each%20Category%20found%0ASummarize(%20dt%2C%20Categories%20%3D%20ByGroup(%20%3Atemp%20)%20)%3B%0AnumCategories%20%3D%20N%20Items(%20Categories%20)%3B%0A%0AFor(%20i%20%3D%201%2C%20i%20%26lt%3B%3D%20numCategories%2C%20i%2B%2B%2C%20%0A%20%2F%2F%20Subset%20the%20dtCat%20table%20into%20the%20a%20new%20data%20table%20with%20just%20the%20one%0A%20%2F%2F%20category%20being%20processed%0A%20dtCat%20%26lt%3B%26lt%3B%20select%20where(%20%3Atemp%20%3D%3D%20Categories%5Bi%5D%20)%3B%0A%20dtSub%20%3D%20dtCat%20%26lt%3B%26lt%3B%20subset(%20selected%20rows%20%3D%3D%201%2C%20selected%20columns(%200%20)%20)%3B%0A%20%0A%20%2F%2F%20set%20the%20offset%20of%20where%20to%20start%20the%20renaming%0A%20offset%20%3D%203%3B%0A%20%0A%20%2F%2F%20Loop%0A%20%2F%2F%20Change%20names%20in%20dt1%20to%20match%20the%20Label%20in%20%0A%20For(%20k%20%3D%201%2C%20k%20%26lt%3B%3D%20N%20Rows(%20dtSub%20)%2C%20k%2B%2B%2C%0A%20%20Eval(%0A%20%20%20Substitute(%0A%20%20%20%20%20Expr(%0A%20%20%20%20%20%20Column(%20__dt__%2C%20k%20%2B%20offset%20)%20%26lt%3B%26lt%3B%20set%20name(%20Word(%203%2C%20dtSub%3AData%5Bk%5D%2C%20%22.%22%20)%20)%2C%0A%20%20%20%20%20%20Expr(%20__dt__%20)%2C%0A%20%20%20%20%20%20Parse(%20%22dt%22%20%7C%7C%20Char(%20i%20)%20)%0A%20%20%20%20%20)%0A%20%20%20)%0A%20%20)%0A%20)%3B%0A%20%0A%20Close(%20dtSub%2C%20nosave%20)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
david_sam
Level II

rename column names in a jmp file as per values in rows in a separate .csv file

Hello, 

I am newbie to JSL, so appreciate help.
I have three files.

file #1: It is the Reference file, [as ref.csv] holding 3 cols as below. 

 

Category, width, label
--------------------------------
A,0,L1.abc
A,1,L2.xt
A,2,L8.dr
A,3,L20.ws
A,4,L72.oz
B,0,L11.qq
....
B,6,L61.er

 

file #2: data file#1 in JMP, holding Category, Data and many other cols.
file #3: data file #2 in JMP, holding Category, Data and many other cols.
difference between the two data files [File #2 and file #3] is the category type and width of value in data col.

Data file #1:

Category|data|many cols.....
----------------------------------------
A 123.23 ....
A 321.45 .... 
.....
many rows

 

the width of values in the column "data" [excluding the dots] is matching to the # of rows in file #1 for a given category
example:
width of 123.23 in row 1 in data file#1 is 5.
the # of rows in reference file for category A would be 5. this need not be tested per say. this is how the tables are coming in [ie when pulled from the source]

In the future, in the reference file , say for category A , the # of rows increase to 6 or more, the width of the value held in the data column in file data file #1 would also increase when information is pulled from database.

Data file #2:

Category|data|many cols.....

----------------------------------------
B 1236.23 ....
B 3213.45 .... 
.....
many rows


Goal 1:create new cols dependent on the width of value held in the "data" col in the datafile #1 [and other data files]
I am done with goal # 1 !


ex:
updated data file#1 would look like this:
Category|data|c1|c2|c3|c4|c5|many cols.....
----------------------------------------
A 123.23 1 2 3 2 3 ....
A 321.45 3 2 1 4 5 .... 
.....


goal 2: rename the new cols in data file #1 [ie c1 to c5] to L1... to L72... as defined in the column "label" in the reference file. no change in the cells values, just update the selected col names.


expected output after goal 2 is done:
Update the data file #1 to look like this:
Category|data|L1.abc|L2.xt|L8.dr|L20.ws|L72.oz|many cols.....
----------------------------------------
A 123.23 1 2 3 2 3 ....
A 321.45 3 2 1 4 5 .... 
.....


I need help with goal #2.

For goal #2 I opened the reference file but not sure to move forward.

 

Thanks
David

10 REPLIES 10
txnelson
Super User

Re: rename column names in a jmp file as per values in rows in a separate .csv file

OK.....this is a bit picky.....but what is in the dataTablesList are not a list of data table names but data table() functions, which point to data tables.
{"Table1","Table2"} // A list of data table names
{ data table( "Table1" ), data table( "Table2" ) } // a list of pointers to data tables
Jim

Recommended Articles