Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Performanslı ve güvenli bir script yazmak için ipuçları

Elinizdeki bir nesneyi başka bir nesneye kopyalamak istediğinizde, bu işlemi Set komutuyla veritabanına gitmeden yapabilirsinizTips for writing a high-performance and secure script


When you request to copy an object to another object, you can do this without going to the database with the Set command.


Code Block
// KaynakReading taşımathe kabınıntarget Idcontainer siwith ilethe hedefsource taşımacontainer kabıId veritabanındanfrom okunuyordatabase
Container.Get(@@Container.Id,@@Container2)
 
// VeritabanınaAssigning gitmeden,source kaynakcontainer taşımaobject kabıto nesnesitarget hedefcontainer taşımawithout kabınagoing atanıyorto database
Set(@@Container2, @@Container)

Get işlemi, okunan nesnenin içindeki bağlantılı nesneleri de otomatik doldurur. Eğer sadece ana nesneye ihtiyacınız varsa, Get komutunun 2. parametresine nesnenin adını yazabilirsiniz.The Get operation also auto-fills the linked objects within the read object. If you only need the main object, you can type the name of the object in the 2nd parameter of the Get command.

Code Block
// BuThis işlemoperation @@Addressreads nesnesiand ilefills birliktein ilgilithe @@Warehouse, @@WarehouseFloor, @@WarehouseZone, @@WarehouseBlock nesneleriniobjects defrom veritabanındanthe okuyup doldururdatabase along with the @@Address object.
Address.Get("Address='@AdresBarkod'")
 
// BuThis işlemoperation sadeceonly @Adresfills nesnesinithe veritabanından@Address okuduğuobject adreswith bilgisiyle doldururthe address information read from the database.
Address.Get("Address='@AdresBarkod'",@Adres)

Scriptteki tüm nesneler globaldir. Yani bir kez dolduğunda, boşaltılmadığı ya da başka bir komutla doldurulmadığı müddetçe dolu kalır. Kayıt hataları yaşamamak için, işlem öncesinde işlemi etkileyecek değişkenleri boşaltmalısınızAll objects in the script are global. Once it is filled in, it stays filled unless it is reset or filled by another command. To avoid saving errors, you should reset the variables to affect the operation before the operation.

Code Block
// ResetVariables komutucommand hafızadakiresets değişkenlerivariables boşaltırin memory.
ResetVariables({"name":["@@ProductionOrder","@@ProductionOrderLine","@@WorkOrder","@@WorkOrderLine","@@OrderSlip","@@OrderSlipLine","@@Arp"]})

Sık yaptığınız işlemleri ortak bir forma taşıyarak oradan çağırabilir, scriptinizin daha kısa ve derli toplu olmasını sağlayabilirsinizYou can call the frequently performed operations by transferring them to a common form, and you can make your script shorter and compacter.

Code Block
Set(@YetkiKodu, "GIRIS") // AdresAssigning içinthe kullanılacakauthorization yetkicode koduto değişkeneuse atanıyor
for the address to the variable
CallForm(AdresListeleSec) // Adres seçimCalling formuthe çağrılıyoraddress selection form
If(@AdresSecimSonucu = -1,Goto(BasaDon)) // Formdan hatalıRedirecting sonuçthe dönmüşse script yönlendiriliyorif the wrong result is returned from the form
 
BeginForm(AdresListeleSec) // OrtakCommon adresaddress seçimselection formuform
    Set(@AdresSecimSonucu, 0) // SonuçResetting değişkeniresult sıfırlanıyorvariable
    Address.List("AuthCode='@YetkiKodu'","",@AdresListesi)
    If(@AdresListesi.rowCount<1)
        ShowMessage({"title":"UYARI","message":"Tanımlı Adres Bulunamadı","buttons":"TAMAM"},@Secenek)
        Set(@AdresSecimSonucu, -1) // SonuçIncorrect değişkeniresult hatalıvariable
olarak belirleniyor     Else()
        If(@AdresListesi.rowCount = 1) // Tek adres varsa direkt @@Address değişkenine atanıyor
            Address.Get(@AdresListesi.rows.1.Id)
        Else() // Birden çok adres varsa listeden seçip yaptırılıyor
            PopupView(@AdresListesi.rows,{"mode":"list","title":"Kabul Adres Listesi","fields":["Address|Adres Tanımı|15|L"]},@sira)
            Address.Get(@[email protected])
        EndIf()
    EndIf()
    ReturnForm() // Bu formu çağıran satıra geri dönülüyor
EndForm()

...