Submitted by lbw2112 on 2019/01/05 19:44
 Hello,
   The "import from : text file(s)"  works great and is making things a lot easier, but is there a way to import the files without it putting the file extension in the Item name?  
 
Thanks,
Larry

Comments

Hi Larry,
 
Not right now, but it is on the wish list
 
You can however batch get rid of the extension using VBScript.
Get back to us if you want more information on how to do it
 
Pierre_Admin
IQ Designer
 

lbw2112

2019/01/05 21:07

In reply to by Pierre_Admin

 Hi Pierre,
 
  Great to know it's on the wish list.  Everything that I'd like IQ to do you're already working on if it doesn't exist already. Incredible.
 
I can wait until it's implemented but it's nice to know that you can do just about anything in VBScript.  I think it'll be fun to start learning more on that.
 
As always, thanks for the really fast response and thanks for IQ.
 
Larry

Pierre_Admin

2019/01/05 21:35

In reply to by lbw2112

Hi Larry
 
1- In Visual Basic Editor, tab User code or This database, enter:
 
Function FileNameNoExt(FName)
  dim i, s

  s = FName
  i = instrrev(fname,".")
  if i > 0 then
    s = left(fname,i-1)
  end if

  FilenameNoExt=s
End Function
 
2- Click Validate Code, Save and Close
 
3- Create a new text field, called TempTxt. In Equations > Row Equation, enter =FileNameNoExt([Item])
 
4- DO NOT click on the Refresh button on the right of the equation box, as this would apply the equation to all items
 
5- Add the field TempTxt to your grid
 
6- Select 1 or more imported file items, those which you want to rename the item to remove the extension
 
7- Do Edit > Touch. This basically does as it you modified the item and will trigger the row equation
 
8- The TempTxt field should now be filled with just the file name (no extension)
 
9- Repeat for all such items (select all these items and do Edit > Touch). All items should automatically have a value for the TempTxt field
 
10- When you're happy with the result, you can copy the cell values from the TempTxt column to the Item column
(Select all text, Edit > Copy, Select cells in the Item's column, Edit > Paste)
 
11- Delete the field TempTxt or at least, turn off its row equation
 
Voilà !
 
 
Pierre_Admin
IQ Designer
 

lbw2112

2019/01/06 07:28

In reply to by Pierre_Admin

 Hi Pierre,
 
That is so awesome!  Thank you very much for that and the detailed directions of what to do. It worked perfect and also let me see the basics of what programming IQ with VBS entails.
 
 
My first entry into VBScript on IQ and has started me on the path of learning that language.
 
I don't want to waste more of your time, but would you have any recommendations on what to read or search for to learn VBS only to use it in IQ for a complete beginner?
 
 
Again, thank you for your time and for all the help.
 
Larry