Adding table item
removeAllItems("tr_randevu_tablosu");
var doktor = getComponent("tr_kullanici_tablosu").selectedItem;
if(doktor != null){
var tumRandevular = query("from randevu where doktor_sec.eposta='" + doktor.eposta + "'");
foreach(rand:tumRandevular){
addTableItem("tr_randevu_tablosu", rand);
}
}else{
warn("Choose Doctor","Doktor Seçin");
}
Ordered List
var saatler = query("from saat_list order by key asc");
var saatMap = new java.util.HashMap();
saatMap.put("key","value");
foreach(saat:saatler){
saatMap.put(saat.key,saat.desc_english);
}
saatMap.remove("key");
var saatArray = [];
var result = new java.util.HashMap();
foreach(saat:saatMap.entrySet()){
var saatData = create("map");
saatData.map_key = saat.getKey();
saatData.map_value = saat.getValue();
saatArray.add(saatData);
}
Setting a combobox
var appState1 = query("from randevu_durumu_list where key='gorusuldu'")[0];
Query
var secret = '6LepWQMTAAAAAGszBQjPHxrdEsctmGo0miRW4vWR';
var response = input.dogrulama;
recaptcha = callRestService("https://www.google.com/recaptcha/api/siteverify?secret={secret}&response={response}", "GET")
.withUrlParameter("secret", secret)
.withUrlParameter("response", response)
.perform();
-----------------------------------------------------------------------
var appointmentId = [convertToDouble(input.appointmentId).longValue()];
var getAppointment = query("from randevu where id=?", appointmentId);
var appointment = getAppointment[0];
-----------------------------------------------------------------------
var status = new java.util.ArrayList();
status = ["gorusuldu"];
var appointmentStatus = query("from randevu_durumu_list where key=?", status);
-----------------------------------------------------------------------
var andWord ="and";
var hql = " from kullanici where kullanici_tipi.key='doktor' and";
if (ad != null)
hql += " ad like '" + ad + "%' " + andWord;
hql = hql.substring(0, hql.lastIndexOf(andWord));
var doktorlar = query(hql);
-----------------------------------------------------------------------
totalCounts = query("select randevu_durumu.key, count(*) from randevu where hasta_sec.eposta='" + input.eposta + "' group by randevu_durumu.key");
paket_list = query("from user_packages where hasta_sec.eposta='" + input.eposta + "' and DATE_FORMAT(paket_sec.duedate,'%Y-%m-%d') >= '"+formatDate("yyyy-MM-dd", today())+"' order by paket_sec.duedate desc ");
Image List
var orgUrl = getOrgWebsiteUrl();
orgUrl = orgUrl.substring(0,orgUrl.length()-1);
var orgName = orgUrl.substring(orgUrl.lastIndexOf("/")+1);
var imgUrl = "https://www.imona.com/platform/rest/imageService/";
imgUrl += orgName + "/drapp/kullanici/"+ doktor_sec.id +"/resim";
kullanici -> entityname
resim -> Term Image type
----------------------------------------
-----------------------------------------
function createImageUrl(doctor){
var imageUrl = getPlatformRestUrl() + "imageService/" + organization.name + "/drapp/kullanici/" + doctor.id + "/resim";
// "https:\/\/www.imona.com\/platform\/rest\/imageService\/doctororg\/drapp\/kullanici\/14\/resim",
return imageUrl;
}
Function ArrayList and Hashmap
function addAssociateToResponse(item){
var assc = new java.util.HashMap();
assc.put("uniqueName",item.unique_name);
assc.put("thumbnailUrl", item.thumbnail_url);
return assc;
}
var result = new java.util.HashMap();
var allAssociates = query("from associates");
var associateList = new java.util.ArrayList();
result.put("associateList", associateList);
foreach(resultItem : allAssociates){
associateList.add(addAssociateToResponse(resultItem));
}
return result;
Load a form with existing record
//write this in page load event.
//query the data
var data = query("from script")[0];
//then open the form with existing record
openForm("script", data);]
//then put the following code to a button on the page, it stores on to the same record
save(current);
tray("saved successfully!");