Search in txt file, result in grid
Publicado: 10 Sep 2013 07:22
Search in .txt file, result in grid
Pls if any example...
10x

Pls if any example...
10x

Foro Especializado en Autoplay Media Studio y más...
http://www.amsspecialist.com/
function DelimitedToTable(s, d)
if not d or #d < 1 then return nil end
local tbl = {};
local sa = s;
local sD = "";
local nP = string.find(sa, d, 1, true)
while nP do
sD = string.sub(sa, 1, nP-1)
table.insert(tbl, #tbl+1, sD)
sa = string.sub(sa, nP+1, -1)
nP = string.find(sa, d, 1, true)
end
if sa ~= "" then table.insert(tbl, #tbl+1, sa) end
return tbl;
end
tb = TextFile.ReadToTable("test.csv");
pattern = Input.GetText("Input1");
if tb then
for i , v in pairs(tb)do
found=false;
t=DelimitedToTable(v, ",")
for n , k in pairs(t)do
if(String.Find(k,pattern, 1, false)~= -1)then
found=true
end
end
if found then
nrow = Grid.InsertRow("Grid1", -1, true);
Grid.SetColumnCount("Grid1", #t+1);
for n , k in pairs(t)do
Grid.SetCellText("Grid1", nrow, n, k, true);
end
end
end
end