Mesajlar ve Alert'lerMessages and Alerts
MESSAGE KomutuMESSAGE Command
Programcılar, kullanıcıları bilgilendirmek veya confirmation, bir seçenek seçme gibi bazı kritik data almak için popup mesajlar kullanır.Programmers use popup messages to inform users or get some critical data such as confirmation, selecting an option etc.
TROIA'da bu tür mesajları göstermek için "MESSAGE" komutu kullanılır. MESSAGE komutu, mesaj metninin kendisi yerine mesajı tanımlayan bazı parametreler alır (multi language desteği nedeniyle). İşte MESSAGE komutunun temel syntax'ı ve yukarıdaki messagebox'ı gösteren örnek kod:To show such messages in TROIA, “MESSAGE” command is used. MESSAGE command gets some parameters that defines the message instead of message text’s itself (because of multi language support). Here the basic syntax of MESSAGE command and sample code that shows messagebox above:
MESSAGE {module} {messagetype}{messageid} WITH {inputparamsformessagetext};MESSAGE {module} {messagetype}{messageid} WITH {inputparamsformessagetext};
/* örnek kod, mesaj metninde %s yok,/* sample code, there is not any %s in message text,
bu yüzden WITH keyword'ünden sonra bir parametre yok */so there is not a paremeter after WITH keyword */
MESSAGE BAS C100 WITH;MESSAGE BAS C100 WITH;
Bu, MESSAGE komutunun en basit ve en çok kullanılan syntax'ıdır; seçenekler ve default seçenek gibi daha fazla detay için lütfen ilgili help dokümanlarına bakınız.This syntax is simples and most used syntax of MESSSAGE command, for more details such as options and default option please see related help documents.
Mesaj metinleri, mesaj tanım parametreleri kullanılarak "SYST02 - System Messages" transaction'ında tanımlanır. Bu parametreler mesajın module'ü ve basit bir long number olan bir message id'sidir. MESSAGE komutu, module, id ve kullanıcının login language'ını kullanarak uygun mesaj metnini ve seçenekleri bulur.Message texts are defined in “SYST02 - System Messages” transaction using message definition parameters. This parameters are the module of messsage and an message id which is simple long number. MESSAGE command finds the appropriate message text and options using module, id and user’s login language.
"SYST02 - System Messages" transaction'ında, mesaj metinlerini ve seçenekleri birden fazla dilde tanımlamak mümkündür. Mesaj metinleri, MESSAGE komutunda WITH keyword'ü kullanılarak runtime'da sağlanacak parametreler için '%s' string formatting karakterini içerebilir. Ayrıca kelime sırası dilden dile değişiyorsa text parametreleri için '%s1', '%s2' gibi index'ler tanımlamak da mümkündür.In “SYST02 - System Messages” transaction, it is possible to define message texts and options in multiple languages. Message texts can contain ‘%s’ string formatting character for the parameters which will be provided on runtime using WITH keyword on MESSAGE command. Also it is possible to define indexes for text parameters like ‘%s1’, ‘%s2’ for if the word order changes language by language.
Mesaj Type'larıMessage Types
Message Type, mesajın user interface'deki görünümünü ve kullanıcının bir seçenek seçme, text girme veya bir information mesajında sadece ok butonuna tıklama gibi mesajla nasıl etkileşime gireceğini etkiler. Tüm message type'ları aşağıda listelenmiştir:Message Type effects message appearence on user interface and the way how user will intract with message such as selecting an option, making a text input or just clicking ok button on an information message. All message types are listed below:
| Type | Code | |
|---|---|---|
| INFORMATION | I | Information icon on message popup |
| ERROR | E | Error icon on message popup |
| WARNING | W | Warning icon on message popup |
| CONFIRMATION | C | Yes/No Questions |
| OPTION | O | Custom options |
| PARAMETER | P | User Keyboard Input |
User Response & System Variable'larını OkumaReading User Response & System Variables
CONFIRMATION, OPTION veya PARAMETER message type'larında, hangi seçeneğin seçildiğini veya kullanıcının girdiği text'i okumamız gerekir. User response, CONFIRM ve SYS_CONFIRMTEXT system variable'larına ayarlanır, bu yüzden programcılar değeri okuyup user input'una göre bir şeyler yapabilir. Confirmation mesajlarında, kullanıcı yes seçeneğini seçtiğinde CONFIRM system variable'ı YES olarak ayarlanır, aksi halde NO olarak ayarlanır.CONFIRMATION, OPTION or PARAMETER message types, we need to read which option is selected or the text input by user. User response is set to CONFIRM and SYS_CONFIRMTEXT system variables, so programmers can read the value and do something due to user input. In confirmation messages, CONFIRM system variable is set to YES when user selects yes option, otherwise it is set to NO.
MESSAGE BAS C100 WITH;MESSAGE BAS C100 WITH;
IF CONFIRM == 'YES' THENIF CONFIRM == 'YES' THEN
STRINGVAR1 = 'Kullanıcı dedi ki: evet!'; STRINGVAR1 = 'User said: yes!';
ELSEELSE
STRINGVAR1 = 'Kullanıcı dedi ki: hayır!'; STRINGVAR1 = 'User said: no!';
ENDIF;ENDIF;
Option mesajlarında, CONFIRM variable'ı seçilen seçeneğin sırasını gösteren bir integer'a, SYS_CONFIRMTEXT ise seçilen seçeneğin text değerine ayarlanır.In option messages, CONFIRM variable is set to an integer which shows the order of selected option and SYS_CONFIRMTEXT is set to text value of selected option.
MESSAGE komutunda ayarlanan başka bir system variable SYSMESSAGE'dır. SYSMESSAGE, mesaj metnine ihtiyacı olan programcılar için mesaj metnine ayarlanır. Mesaj metninin, verilen module, messageid, login language ve uygulanan mesaj parametreleri kullanılarak hesaplandığını unutmayın.Another system variable which is set on MESSAGE command is SYSMESSAGE. SYSMESSAGE is set to message text for programmers who need message text. Remember message text is calculated using given module, messageid, login language and applied message parameters.
Batch/Server Transaction'larda MesajMessage on Batch/Server Transactions
Görüldüğü gibi, mesajlar client tarafında gösterilir ve client tarafı bir etkileşim gerektirir, bu yüzden interpreter bir message komutu çalıştırırken, client'a döner ve bir client etkileşimini bekler. Bu duruma "code breaking" denir ve basitçe "server tarafında code execution sırasında bir client tarafı kaynağı kullanma" olarak kabul edilir.As it is obvious, messages shown on client side and needs a client side interaction, so while interpreter running a message command, it returns client and waits for a client interaction. This case is called “code breaking” and simply considered as “using a client side resource while code execution in server side”.
Batch transaction'larda, message dialog'uyla etkileşime girebilecek veya yanıt verebilecek bir kullanıcı yoktur, bu yüzden interpreter davranışı batch ve inserver (INSERVER) transaction'larda farklıdır. Bu tür yalnızca server code execution'larında, sistem mesajları default seçenekle otomatik olarak yanıtlar, tüm confirmation mesajlarını confirm eder (YES) ve information/warning mesajlarını yok sayar. Ayrıca tüm mesajları, mesaj, session ve server bilgisini saklayabilen IASBATCHERR system table'ına ekler.In batch transactions, there is no user that is able to interact or answer message dialog, therefore intepreter behavior is different on batch and inserver (INSERVER) transactions. In this kind of server only code executions, system automatically answer messages with default option, confirms (YES) all confirmation messages and ignores information/warning messages. Additionally inserts all messages to IASBATCHERR system table which is able to store message, session and server information.
İşte bir batch transaction'da IASBATCHERR table'ından mesajlarınızı almanın bir örneği:Here is an example how to get your messages from IASBATCHERR table on a batch transaction:
SETBATCHTRAN TRUE;SETBATCHTRAN TRUE;
MESSAGE BAS E110 WITH;MESSAGE BAS E110 WITH;
MESSAGE BAS E110 WITH;MESSAGE BAS E110 WITH;
MESSAGE BAS E110 WITH;MESSAGE BAS E110 WITH;
SELECT *SELECT *
FROM IASBATCHERR FROM IASBATCHERR
WHERE CLIENTCONNID = SYS_CLIENTCONNECTIONID WHERE CLIENTCONNID = SYS_CLIENTCONNECTIONID
AND TRANSID = SYS_TRANSACTIONID AND TRANSID = SYS_TRANSACTIONID
INTO TMPTABLE; INTO TMPTABLE;
SET TMPTABLE TO TABLE TMPTABLE;SET TMPTABLE TO TABLE TMPTABLE;
SETBATCHTRAN FALSE;SETBATCHTRAN FALSE;
Database Transaction'larında MesajMessage on Database Transactions
"Database transaction"lardaki (BEGINTRAN-COMMITTRAN arasındaki) mesajlar server tarafından otomatik olarak yanıtlanır ve "database transaction" kapandıktan sonra client tarafına information mesajı olarak gönderilir. "Database transaction"da ortaya çıkan tüm mesajlar client'a toplu bir information mesajı olarak aktarılır. Sql transaction'larındaki mesajlar, type'ı table olan SYSBATCHMESSAGES system variable'ında saklanır. Bu, database access bölümünde detaylıca ele alınacaktır.Messages on “database transactions” (between BEGINTRAN-COMMITTRAN) are answered automatically by server and sent to client side as information messages after “database transaction” closed. All messages emerged in “database transaction” are transferred to client as a bulk information message. Messages on sql transactions are stored in SYSBATCHMESSAGES system variable whose type is table. It will be discussed detailly in database access section.
İşte bir system variable olan SYSBATCHMESSAGES table'ından mesajları nasıl alacağınızı gösteren örnek bir kod:Here is a sample code that shows how to get messages from SYSBATCHMESSAGES table which is a system variable:
SETSERVERONLY(1);SETSERVERONLY(1);
MESSAGE BAS E110 WITH;MESSAGE BAS E110 WITH;
MESSAGE BAS E110 WITH;MESSAGE BAS E110 WITH;
MESSAGE BAS E110 WITH;MESSAGE BAS E110 WITH;
COPY TABLE SYSBATCHMESSAGES INTO TMPTABLE;COPY TABLE SYSBATCHMESSAGES INTO TMPTABLE;
SET TMPTABLE TO TABLE TMPTABLE;SET TMPTABLE TO TABLE TMPTABLE;
SETSERVERONLY(0);SETSERVERONLY(0);
Push Notification'larPush Notifications
24.12.26-01 build'inden sonra, TROIA Platformu push notification'ları destekler. Business application'ın business ihtiyaçları nedeniyle PUSHNOTIFICATION komutuyla bir push notification oluşturulabilir. Bu push notification, desktop, web ve mobile toolkit dahil bir user interface'i olan client'lara iletilebilir. Güncel syntax için lütfen TROIA help dokümanını kontrol edin.After build 24.12.26-01, TROIA Platform supports push notifications. A push notification can be created by PUSHNOTIFICATION command due to business needs of the business application. This push notification can be delivered to the clients which have an user interface including desktop, web and mobile toolkit. For an up to date syntax please check TROIA help document.
Diğer Alerting SeçenekleriOther Alerting Options
TROIA'da, control'lere işaret etmek veya kullanıcıların dikkatini çekmek için bazı popup'lar oluşturmak için başka seçenekler de vardır. Farklı user interface'lere ve etkileşim yöntemlerine sahip ATTENTION ve ALERT komutlarının help dokümanlarına bakınız.In TROIA, there are some other options to point out controls or create some popups to take users attention. Please see help documents of ATTENTION and ALERT commands which have different user interfaces and interaction methods.
Alıştırma 1: Mesaj Metnini/Yanıtını OkumaExercise 1: Reading Message Text/Answer
- Bir option mesajı tanımlayın.Define an option message.
- Format text (%s) içeren bir confirmation tanımlayınDefine a confirmation which contains format text (%s)
- Önce option mesajını gösteren ve seçilen mesajı ikinci confirmation mesaj metninize yazdıran bir button ekleyin.Add a button which shows option message first and prints selected message to your second confirmation message text.
- Confirmation mesaj metninizi ve yanıtını bir textfield'a yazdırın.Print your confirmation message text and answer to a textfield.