Dear Experts, Below Sample Code showing list of Files but not opening file, as tested with Latest Tally.ERP 9 Rel 4.5, please do the needful. Thanks Code: ;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara /* Objective(s) – - This code demonstrates the Enhancement done on 'Data Source' Attribute within the collection - Directory Syntax - - Attribute 'Datasource' Syntax [Collection : <Collection Name>] Data Source : <Type> : <Identity> [:< Encoding>] Updation History – - Created on 31/1/2011 */ [Report: TSPL Smp Directory Data Source] Form : TSPL Smp Directory Form Title : "Directory as Data Source" [Form: TSPL Smp Directory Form] Parts : TSPL Smp Info, TSPL Smp Directory Part ON : Form Accept : Yes : CALL : TSPL Smp Open File Width : 40% Page Local : Part : TSPL Smp Info : Local : Line : Info : Local : Field : Info Field : Info : "The selected file will be read, logged and opened" [Part: TSPL Smp Directory Part] Lines : TSPL Smp Directory Line [Line: TSPL Smp Directory Line] Fields : TSPL Smp Directory Path, TSPL Smp ListofFiles [Field: TSPL Smp Directory Path] Use : Name Field Set As : ##TSPLSmpDirectoryPath Modifies : TSPLSmpDirectoryPath : True Tooltip : "Enter the folder path from where the files are to be listed" Skip Forward: Yes [Field: TSPL Smp ListofFiles] Use : Name Field Table : TSPL Smp Directory Collection Set Always : Yes Show Table : Always Align : Center Width : 40% Page Tooltip : "Please select a file from the Table" /* The Collection 'TSPL Smp Directory Collection' will enable us to gather all the information pertaining to the contents of the disk directory/folder */ [Collection: TSPL Smp Directory Collection] Data Source : Directory : #TSPLSmpDirectoryPath Filter : TSPLSmpTextFiles Format : $Name, 25 Format : $FileSize, 15 Format : $IsReadOnly, 15 Title : "File Listing" Sub Title : "File Name", "File Size", "Read Only" [Function: TSPL Smp Open File] Variable : TSPLSmpFilePath : String 00 : SET : TSPLSmpFilePath : $$TSPLSmpLastCharExists:@@TSPLSmpDirectoryPath:#TSPLSmpListofFiles ;; Opens up the selected file in Notepad Application 10 : EXEC COMMAND : "Notepad" : ##TSPLSmpFilePath [Function: TSPL Smp LastChar Exists] Parameter : pLocPath : String Parameter : pFileName : String Parameter : pLastChar : String : "\" Local Formula : StrLenDir : $$StringLength:##pLocPath Local Formula : LastChar : $$StringPart:##pLocPath:(@StrLenDir - 1):1 Variable : ReturnStr : String 00 : IF : $$ExactMatch:@LastChar:##pLastChar 10 : SET : ReturnStr : ##pLocPath + ##pFileName 20 : ELSE : 30 : SET : ReturnStr : ##pLocPath + ##pLastChar + ##pFileName 40 : ENDIF 50 : RETURN : ##ReturnStr [System: Formula] ;; Specify the required Directory Path TSPL Smp Directory Path : ##TSPLSmpDirectoryPath TSPL Smp Text Files : $$TSPLSmpRefreshTable:#TSPLSmpDirectoryPath AND NOT $$IsDirectory:$Name AND (($Name CONTAINS ".txt" OR $Name CONTAINS ".xml" OR $Name CONTAINS ".sdf" OR $Name CONTAINS ".tdl") AND $Name NOT CONTAINS "tdlserver") ;; Dummy Function introduced to Refresh the Table dependent on the Previous ;; Field Value i.e., User Input [Function: TSPLSmpRefreshTable] Parameter : pTempVar : String 00 : RETURN : True ;; Variable declaration to hold the last updated Directory path [Variable: TSPLSmpDirectoryPath] Type : String Persist : Yes [System: Variable] TSPLSmpDirectoryPath : ".\" ;; End-of-File
The above code is for to List files only not open Open Fiel: [Function: TSPL Smp Open File] Variable: TSPLSmpFilePath: String 00: SET: TSPLSmpFilePath: $$TSPLSmpLastCharExists@TSPLSmpDirectoryPath:#TSPLSmpListofFiles ;; Opens up the selected file in Notepad Application 10: EXEC COMMAND: "Notepad": ##TSPLSmpFilePath
Thanks for reply, I tried above, but If a file name like " Tally Solutions " (text format) not opening showing error Path\Tally.txt was not found. Please solve if file name has more than 1 word.
Any help on above code, as i updated this TSPL Smp Text Files : $$TSPLSmpRefreshTable:#TSPLSmpDirectoryPath AND NOT $$IsDirectory:$Name AND (($Name CONTAINS ".bmp") AND $Name NOT CONTAINS "tdlserver") and also updated this 10 : EXEC COMMAND : "MSPaint" : ##TSPLSmpFilePath but showing error Path\Tally.bmp was not found
Dear Experts, Finally I have Done to Open File from Tally, Thanks for your support. Code: [Function: TSPL Smp Open File] Variable : TSPLSmpFilePath : String 00 : SET : TSPLSmpFilePath : $$TSPLSmpLastCharExists:@@TSPLSmpDirectoryPath:#TSPLSmpListofFiles ;; Opens up the selected file in Notepad Application ;;10 : EXEC COMMAND : "Notepad" :##TSPLSmpFilePath 10 : Browse Url: ##TSPLSmpFilePath Now, I have added a Field to Store Full Path including Drive\Directory\File Name with Extn. Already created a field but showing file name only and not stored when re open form. Please guid
You will get it from TDL Sample Code Provided by Tally at What's new in Rel 3.0 > Collection Enhancement > Directory as Data Source Regards