Hi All.. Jay Here...... Hope You Will Like...... Code: [#Menu:Gateway OF Tally] Add : Key Item : Before: @@locQuit : Files : F : Alter : SelectjkFiles [Collection: FilesDir] Title:"Select Drive" List:"C:\","D:\","E:\","F:\" [Collection: FilesDir1] Title:"Select Folder" SubTitle : "File/Folder Name","Size","Read Only","Last Modified Date","Last Modified Time" Data Source:Directory:#Dirpath Format :$Name,25 Format :$Filesize,10 Format :$IsReadOnly,5 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 [Collection: Files] Title:"Select File" SubTitle : "File/Folder Name","Size","Read Only","Last Modified Date","Last Modified Time" Data Source:Directory:(#Dirpath+#DirPath1) Format :$Name,25 Format :$Filesize,10 Format :$IsReadOnly,5 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 [Report:SelectjkFiles] Form :FileSettings [Form :FileSettings] Part : FileSettings On : form Accept : Yes : Call : OpenJKTarget [Part :FileSettings] Line :FileSettings [Line :FileSettings] Field :DirPath,DirPath1,DirPath2 [Field :DirPath] Use : Name Field Table:FilesDir Dynamic : "" Show Table : Always [Field :DirPath1] Use : Name Field Table:FilesDir1,Endoflist Dynamic : "" Show Table :Always [Field :DirPath2] Use : Name Field Table : Files,Endoflist Dynamic : "" Show Table :Always [Function:OpenJKTarget] 001: if :(#Dirpath2 Contains "Endoflist") 001a : Exec Command : (#Dirpath+#Dirpath1) 002: Else 002a : Exec Command : (#Dirpath+#Dirpath1+"\"+#DirPath2) 004: End if
Code: You May Use Filters As Per Your Requirement. [#Menu:Gateway OF Tally] Add : Key Item : Before: @@locQuit : Files : F : Alter : SelectjkFiles [Collection: FilesDir] Title:"Select Drive" List:"C:\","D:\","E:\","F:\","G:\","H:\","I:\","J:\","K:\","L:\" [Collection: FilesDir1] Title:"Select Folder" SubTitle : "File/Folder Name","Last Modified Date","Last Modified Time","File Type" Data Source:Directory:#Dirpath Format :$Name,25 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 Format : @@JkFileType,10 Filter :JkDir ;Filter :OnlyPdf ;Filter :OnlyXls ;Filter :OnlyXlsx ;Filter :OnlyDoc [Collection: Files] Title:"Select File" SubTitle : "File/Folder Name","Last Modified Date","Last Modified Time","File Type" Data Source:Directory:(#Dirpath+#DirPath1) Format :$Name,25 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 Format : @@JkFileType,10 Filter :JkDir ;Filter :OnlyPdf ;Filter :OnlyXls ;Filter :OnlyXlsx ;Filter :OnlyDoc [System : Formulae] JkDir : ($IsDirectory) OR (($$StringWordEx:$Name:".":@@FileDots:No) Contains "PDF" ) OR (($$StringWordEx:$Name:".":@@FileDots:No) Contains "Doc") OR (($$StringWordEx:$Name:".":@@FileDots:No) Contains "Xls") OR (($$StringWordEx:$Name:".":@@FileDots:No) Contains "Xlsx") JkFileType : IF ($IsDirectory) Then "Folder" Else @@FileType ;OnlyPdf: ($$StringWordEx:$Name:".":@@FileDots:No) Contains "PDF" ;OnlyDoc:($$StringWordEx:$Name:".":@@FileDots:No) Contains "Doc" ;OnlyXls:($$StringWordEx:$Name:".":@@FileDots:No) Contains "Xls" ;OnlyXlsx:($$StringWordEx:$Name:".":@@FileDots:No) Contains "Xlsx" [Report:SelectjkFiles] Form :FileSettings [Form :FileSettings] Part : FileSettings On : form Accept : Yes : Call : OpenJKTarget [Part :FileSettings] Line :FileSettings [Line :FileSettings] Field :DirPath,DirPath1,DirPath2 [Field :DirPath] Use : Name Field Table:FilesDir Dynamic : "" Show Table : Always [Field :DirPath1] Use : Name Field Table:FilesDir1,Endoflist Dynamic : "" Show Table :Always [Field :DirPath2] Use : Name Field Table : Files,Endoflist Dynamic : "" Show Table :Always [Function:OpenJKTarget] 001: if :(#Dirpath2 Contains "Endoflist") 001a : Exec Command : (#Dirpath+#Dirpath1) 002: Else 002a : Exec Command : (#Dirpath+#Dirpath1+"\"+#DirPath2) 004: End if
Thanks For Sharing I am trying File Size in KB, MB, GB but not Succeeded My System formula is given Below Please help for result JkFilesize : IF ($Filesize>1023 and $Filesize=1023) Then "B" or ($Filesize=1024 and $Filesize>1048575) Then ($Filesize/1024)+"KB" or ($Filesize=1048576 and $Filesize>1073741823) Then ($Filesize/1048576)+"MB" or ($Filesize=1073741824 and $Filesize<1073741824) Then ($Filesize/1073741824)+"GB" Else $Filesize
try this (temporary) ---- JkFilesize : $Filesize or use some "dummy text" If not working after above, then problem is elsewhere. Also re-check your last condition for GB in the above formula.
Thanks for Reply only $filesize Accepted and its result in byte, Any other text after $Filesise Not Accepted, Like $FileSize, "KB" , $Filesize+"KB"
I am Using in Collection in above "open File module" as Below [Collection: Files] Title:"Select File" SubTitle : "File/Folder Name","File Type","File Size","Last Modified Date","Last Modified Time" Data Sourceirectory#Dirpath+#DirPath1) Format :$Name,25 Format : @@JkFileType,10 Format : @@JkFilesize,10 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 [System : Formulae] JkFileType : IF ($IsDirectory) Then "Folder" Else @@FileType JkFilesize : IF ($Filesize>1023 and $Filesize=1023) Then "B" or ($Filesize=1024 and $Filesize>1048575) Then ($Filesize/1024)+"KB" or ($Filesize=1048576 and $Filesize>1073741823) Then ($Filesize/1048576)+"MB" or ($Filesize=1073741824 and $Filesize<1073741824) Then ($Filesize/1073741824)+"GB" Else $Filesize
If you want good guidance, then kindly share the code snippet, so others can verify and check it out. Just mere comments is not enough. Show ---- what you have done and typed.......and show full details.
Thank You sir Here is Full Code [#Menu:Gateway OF Tally] Add : Key Item : Before: @@locQuit : Files : F : Alter : SelectjkFiles ;TSPL Smp Directory Data Source; Add : Key Item : Before: @@locQuit : Blank [Collection: FilesDir] Title:"Select Drive" List:"C:\","D:\","E:\","F:\" [Collection: FilesDir1] Title:"Select Folder" SubTitle : "File/Folder Name","File Type","File Size","Last Modified Date","Last Modified Time" Data Sourceirectory:#Dirpath Format :$Name,25 Format : @@JkFileType,10 Format : @@JkFilesize,10 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 [Collection: Files] Title:"Select File" SubTitle : "File/Folder Name","File Type","File Size","Last Modified Date","Last Modified Time" Data Sourceirectory#Dirpath+#DirPath1) Format :$Name,25 Format : @@JkFileType,10 Format : @@JkFilesize,10 Format :$LastModifiedDate, 15 Format :$LastModifiedTime, 15 [System : Formulae] JkFileType : IF ($IsDirectory) Then "Folder" Else @@FileType ;;$Filesize JkFilesize : IF ($Filesize>1023 and $Filesize=1023) Then "B" or ($Filesize=1024 and $Filesize>1048575) Then ($Filesize/1024)+"KB" or ($Filesize=1048576 and $Filesize>1073741823) Then ($Filesize/1048576)+"MB" or ($Filesize=1073741824 and $Filesize<1073741824) Then ($Filesize/1073741824)+"GB" Else $Filesize [Report:SelectjkFiles] Form :FileSettings [Form :FileSettings] Part : FileSettings On : form Accept : Yes : Call : OpenJKTarget [Part :FileSettings] Line :FileSettings [Line :FileSettings] Field irPath,DirPath1,DirPath2 [Field irPath] Use : Name Field Table:FilesDir Dynamic : "" Show Table : Always [Field irPath1] Use : Name Field Table:FilesDir1,Endoflist Dynamic : "" Show Table :Always [Field irPath2] Use : Name Field Table : Files,Endoflist Dynamic : "" Show Table :Always [Function:OpenJKTarget] 001: if #Dirpath2 Contains "Endoflist") 001a : Exec Command : (#Dirpath+#Dirpath1) 002: Else 002a : Exec Command : (#Dirpath+#Dirpath1+"\"+#DirPath2) 004: End if /* =================Data Storage======================= Data Storage Units Bit 1 or 0 Byte (B) 8 Bits Kilobyte (KB) 1024 Bytes Megabyte (MB) 1024 Kilobytes Gigabyte (GB) 1024 Megabytes Terabyte (TB) 1024 Gigabytes Petabyte (PB) 1024 Terabytes Exabyte (EB) 1024 Petabytes Zettabyte (ZB) 1024 Exabytes Yottabyte (YB) 1024 Zettabytes Brontobyte (XB) 1024 Yottabyte */============================end
You must learn to construct the formula properly. There are many examples in TDE. Also when learning or new, always break down the formula in parts, so it is easier to learn, develop and implement/change readily. Code: JkFilesize : IF ($Filesize>0 and $Filesize<=1023) Then $$String:@@FileinByteR + $$String:"B" Else + If ($Filesize>=1024 and $Filesize<=1048575) Then $$String:@@FileinKBR + $$String:"KB" Else + If ($Filesize>=1048576 and $Filesize<=1073741823) Then $$String:@@FileinMBR + $$String:"MB" Else + If $Filesize>=1073741824 Then $$String:@@FileinGBR + $$String:"GB" Else "" FileinByte : $Filesize FileinKB : $Filesize/1024 FileinMB : $Filesize/1048576 FileinGB : $Filesize/1073741824 FileinByteR : $$Round:@@FileinByte:0 FileinKBR : $$Round:@@FileinKB:0 FileinMBR : $$Round:@@FileinMB:0 FileinGBR : $$Round:@@FileinGB:0
Hello @JayKumarTailor @AmitKamdar & Friends I have used File Selection Template and that gives Browse Directory Feature. Sharing the sample code. How can I also get Directory Path, please guide. Code: /* This section Contains the TDL Code for File Selection Template */ [#Menu:Gateway OF Tally] Add : Key Item : Before: @@locQuit : Files : F : Alter : SelectFileModule [Report: SelectFileModule] Form :FileSettingsModule [Form :FileSettingsModule] Part : FileSettingsModule On : form Accept : Yes : Call : DispImpFile [Part: FileSettingsModule] Add : Lines : ImportFile2 [Line: ImportFile2] Fields : Medium Prompt, ImportFileName Local : Field : Medium Prompt : Setas : "Select File to Import:" Local : Field : Medium Prompt : Color : Blue [Field: ImportFileName] Use : File Selection Template Modifies : ImportFileName : Yes : $$TableObj:ImportFileName:$Path Case : Normal Width : @@LongWidth+10 Max : @@MaxNarrWidth Act on Table Element : (@ShowMore OR @ShowLess) : Execute Obj Actions : ShowMoreLess ShowMore : ($$IsSysNameEqual:ShowMore:($$CurrentTableObj:$Name)) ShowLess : ($$IsSysNameEqual:ShowLess:($$CurrentTableObj:$Name)) [System: UDF] ImportFileName: String: 9001 [Function: DispImpFile] 010: Msg Box: "Import File Path": "" 015: Msg Box: "Import File Name": #ImportFileName 020: Return