Startseite › Foren › Deutsches LiveCode-Forum › Data › Antwort auf: Data
Hallo Klaus,
ja, ich geb zu, ich habe gemogelt und mein Script ein wenig verkürzt.
Ich poste jetzt doch das ganze Script, um zu erklären, warum ich es so programmierte.
global xpfd
global xdsg
global xsmd
global xtxs
global xbeg
on mouseUp
switch
case "TY1" is in the target
put "Vorsilbe" into xtxs
set the label of btn bnsmd of card id 1032 to xtxs
Ausblenden
LadeVHE
break
case "TY2" is in the target
put "Wortstamm" into xtxs
set the label of btn bnsmd of card id 1032 to xtxs
Ausblenden
LadeVHE
break
case "TY3" is in the target
put "Endsilbe" into xtxs
set the label of btn bnsmd of card id 1032 to xtxs
Ausblenden
LadeVHE
break
case "BY1" is in the target
if xsmd = false then
set the label of btn bnsmd to "deutsch"
put true into xsmd
else
set the label of btn bnsmd to "medizin"
put false into xsmd
end if
break
case "BY2" is in the target
put empty into fld fdgax
case "BY3" is in the target
put the fld fdgax into xbeg
if xbeg is not empty then
set the label of btn bnglo of card id 1032 to xbeg
else
set the label of btn bnglo of card id 1032 to "alle"
end if
Ausblenden
LadeABC
break
end switch
end mouseUp
on LadeABC
set the itemDelimiter to tab
put revOpenDatabase("sqlite",xpfd, , , , ) into xsql
repeat with x = 1 to xdsg
put "SELECT Begriff, Beschreibung, ID FROM DBMedizin WHERE ID = " &x into xsel
put revDataFromQuery(tab,return,xsql,xsel) into xxerg
put textDecode(xxerg,"UTF-8") into xerg
if xsmd = false then
if item 1 of xerg begins with xbeg then
put item 1 of xerg after xxx
put tab after xxx
put item 2 of xerg after xxx
put tab after xxx
put item 3 of xerg after xxx
put return after xxx
end if
else
if item 2 of xerg begins with xbeg then
put item 1 of xerg after xxx
put tab after xxx
put item 2 of xerg after xxx
put tab after xxx
put item 3 of xerg after xxx
put return after xxx
end if
end if
end repeat
revCloseDatabase xsql
set the dgtext of group "DataM" to xxx
if xsmd = false then
dispatch "SortDataByKey" to grp "DataM" with "medizin","international","ascending","false"
else
dispatch "SortDataByKey" to grp "DataM" with "deutsch","international","ascending","false"
end if
end LadeABC
on LadeVHE
set the itemDelimiter to tab
put revOpenDatabase("sqlite",xpfd, , , , ) into xsql
repeat with x = 1 to xdsg
put "SELECT Begriff, Beschreibung, Erklaerung FROM DBMedizin WHERE ID = " &x into xsel
put revDataFromQuery(tab,return,xsql,xsel) into xxerg
put textDecode(xxerg,"UTF-8") into xerg
if item 2 of xerg begins with xtxs then
put item 1 of xerg after xxx
put tab after xxx
put item 2 of xerg after xxx
replace "Vorsilbe : " with empty in xxx
replace "Wortstamm : " with empty in xxx
replace "Endsilbe : " with empty in xxx
put tab after xxx
put item 3 of xerg after xxx
put return after xxx
end if
end repeat
revCloseDatabase xsql
set the dgtext of grp "DataM" to xxx
dispatch "SortDataByKey" to grp "DataM" with "medizin","international","ascending","false"
end LadeVHE
on Ausblenden
hide graphic viereck
hide fld fdgax
hide btn "TY1"
hide btn "TY2"
hide btn "TY3"
hide btn "BY1"
hide btn "BY2"
hide btn "BY3"
set the dgtext of group "DataM" to empty
show grp "DataM"
end Ausblenden
Ich suche mit WHERE im SELECT, da ich on LadeLABC für die gesamte Suche (A-Z), wie auch für die Suche nach Buchstaben verwende. Ist der Suchbegriff leer, zeigt es mir nämlich alle Datensätze an.
Ich sortiere das DataGrid mit dispatch zum Schluss, da ich „international“ sortieren muss, damit die Umlaute bei A,O und U einsortiert werden, sonst werden sie ans Ende gestellt. (war zumindest mit der Sortierung vom DataGrid so, was vermutlich order by entspicht)
Es lädt bei mir übrigens so schnell, dass es auch nur ratzefatze-fertig macht.
Mein Zauberwort heißt begins with (like) und funkt auch gut.
Meine Frage ist aber : Wie kann ich das DataGrin in der Anzeige hin- und herschieben, denn wenn ich nur „D“s lade, kann ich nicht nach „C“ und „E“ rüberschieben.
Das Data Grid ist eigentlich nur eine Textdatei. Wie springe ich darin in den Zeilen von Buchstabe zu Buchstabe ? Zurück scrollt es ja von allein,
Kann ich die Zeile im DataGrid suchen (die z,B, mit D beginnt) und dann dorthin springen ?
Deine Antwort werde ich aber genau durchgehen und ausprobieren. Wie immer !
Ich habe mir heute die Indy-Lizenz gekauft. Juchu ! (€ 158 mit Cloud)
—–> jetzt nerve ich euch noch mehr <————-
Beste Grüße herby
