<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Piyanat Nimkhuntod on Medium]]></title>
        <description><![CDATA[Stories by Piyanat Nimkhuntod on Medium]]></description>
        <link>https://medium.com/@farmonline?source=rss-e3170bbc36b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_1F72ub4kqcx_hcgXrqYcQ.jpeg</url>
            <title>Stories by Piyanat Nimkhuntod on Medium</title>
            <link>https://medium.com/@farmonline?source=rss-e3170bbc36b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 20:01:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@farmonline/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[เก็บข้อมูล เก็บรูปภาพ แล้ว สร้าง รายงาน PDF ด้วย Appsheet]]></title>
            <link>https://farmonline.medium.com/%E0%B9%80%E0%B8%81%E0%B9%87%E0%B8%9A%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5-%E0%B9%80%E0%B8%81%E0%B9%87%E0%B8%9A%E0%B8%A3%E0%B8%B9%E0%B8%9B%E0%B8%A0%E0%B8%B2%E0%B8%9E-%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7-%E0%B8%AA%E0%B8%A3%E0%B9%89%E0%B8%B2%E0%B8%87-%E0%B8%A3%E0%B8%B2%E0%B8%A2%E0%B8%87%E0%B8%B2%E0%B8%99-pdf-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-appsheet-8b853e1c9b0f?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b853e1c9b0f</guid>
            <category><![CDATA[image]]></category>
            <category><![CDATA[report]]></category>
            <category><![CDATA[pdf]]></category>
            <category><![CDATA[appsheet]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Mon, 11 Aug 2025 03:47:18 GMT</pubDate>
            <atom:updated>2025-08-11T03:47:18.293Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7d8H8EGA5kHXIIO0mrLDQQ.png" /></figure><p>ก่อนอื่นเลยให้เราเข้าไปที่ appsheet.com หากยังไม่เคยสมัครก็ให้ สมัครไว้ก่อนครับ หากใครสมัครเรียบร้อยแล้วก็ให้เข้าใช้งานโดยเลือกจากรายการด้านล่างที่เราผูกไว้ตอนสมัครสมาชิก แล้วกด ตามขั้นตอนไปเรื่อยๆ จนเจอหน้าจอ home</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*KaV_9kvw-XJTqShZPBj0OA.png" /></figure><p>เลือกที่ Database แล้ว คลิกที่ Create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*ZrGm3jb5zxA2VmmbdXcQkg.png" /></figure><p>เลือก New Database จริงๆแล้วเราสามารถเลือก Import from Sheets ได้แต่ผมมองว่ามัน Lock ตารางไม่ให้ใครมาแก้มั่วๆไม่ได้ หรือจะบอกว่ามันสามารถเข้าถึงได้ง่ายเกินไปก็ไม่ผิดนักมันทำให้โปรแกรมอาจรวนได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*UkwDWoGnmtRPmuaC6Zq9gA.png" /></figure><p>ให้เราทำการใส่ค่าลงไปในตาราง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIDO16a8iMThllK0kVvhxg.png" /></figure><p>ตั้งชื่อ Database ของเรา เอา Mouse ไปคลิกที่ Untitled (อ่านว่า อัน ไตเติ้ล) แล้วเปลี่ยนเป็นชื่อมงคลที่เราชอบ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*Xr-EDwoHXs2ajnGLEX_Wiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*rSBmH8TDGkAA0qoRZmySuw.png" /></figure><p>ทำการเปลี่ยนชื่อ ตาราง ให้คลิกที่จุด สามจุด</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*-4OapphmOfK3JvOy7QOWIQ.png" /></figure><p>เลือก Table Settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*6LWExGzqKeo2e6BPt8bg2g.png" /></figure><p>ใน Table Setting สามารถเปลี่ยนชื่อได้ใน Table Name</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*LZgg9dubHEL1PT994gySpw.png" /></figure><p>เพิ่ม Column โดยการกด + Add column</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*6CMlmk2qwvy2fCYdFEK2aw.png" /></figure><p>ใส่ชื่อ column ในช่อง Name แล้วเลือก Type ซึ่งในกรณีนี้ผมจะเพิ่ม Image <br>Name = Image ,Type = Image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*GdvM98xZAkXSstg1W5bDkw.png" /></figure><p>บันทึก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*_on9Ig8RPsMY22vo44MHgg.png" /></figure><p>หากต้องการแก้ไข column กด . จุดสามจุดแล้วเลือก Edit column</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*AeEN69wWJcs0zIj13RW9ew.png" /></figure><p>เมื่อเสร็จแล้วให้กด Back กลับมาเรื่อยๆ จนถึงหน้า home จะเจอ Database ที่ชื่อ Demo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*MK0wSKtglUQwKN0c-9kEcw.png" /></figure><p>เลือก Tab app กด Create เลือก App แล้ว Blank app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*qtD3_cBBrdZPqqtJK5F2sw.png" /></figure><p>ใส่ชื่อ App name และ Category จากนั้นกด Create app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*Qi-BAQd-q_jX8JCblkkqiw.png" /></figure><p>ระบบจะสร้าง Project ขึ้นมาให้ใหม่ กด Customize with appsheet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7QKt6HttdechnlejdCzFg.png" /></figure><p>เลือก Tab <strong>Data</strong> แล้วเลือก New Table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*Tvmrz2wy9NOcLmt-5-bNMQ.png" /></figure><p>เลือก AppSheet Database</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*pDpTsTR6YZFJfv3DcdUlAg.png" /></figure><p>เลือก Demo ที่เราสร้างไว้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*zOqUWEtn29UXb7PryfZP7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*-_klWwPEPkAIXMNfQ-O_Zw.png" /></figure><p>สามารถเปลี่ยนชื่อ Table ได้จากตรงนี้เหมือนกัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*huBNuFYZbkQ0tR_VxdtFmQ.png" /></figure><p>แล้วก็ SAVE</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*5Mi2Jxg9OJ_JaoDQbu1MeQ.png" /></figure><p>คลิกที่ DamageReport</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9srLj0bSBN4B3qhmv20hmg.png" /></figure><p>กด View Data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Rp2KnUDX6mJwo7BIJC2Ag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*Rr1FrGF1Cd3sNH9Tdzny0w.png" /></figure><p>กด Edit เพื่อเข้าไปดูในตาราง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EO02aTJZKgif-I_oxMDnAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOSGQF1Yyd9z1-V-6P0glg.png" /></figure><p>กรณีที่เราต้องการจะสร้างรายงาน เรามีความจำเป็นต้องสร้าง Column ชื่อ FileName ไว้เพื่อให้ View เรียกไปใช้ได้ โดยเราไปที่ Add Column เหมือนเดิม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*fa4AFFSPUG_O7vK9zZYELw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJXVpOHRuPQ0mAdAZ8m6jA.png" /></figure><p>ให้เรากลับไปที่ Data แล้ว กด View Columns จะเห็นว่า Field Picture และ Filename ยังไม่มีให้กด Regenerate Structure</p><blockquote>จำไว้ว่าหากมีการแก้ โครงสร้างของตารางต้องมากด ที่ Regenrate Structure ทุกครั้ง</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkvnFriB9wMpOuoM6fcTkg.png" /></figure><p>กด Regenerate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*2rLN43gUm8qATogE56UXlA.png" /></figure><p>ทั้งสอง Field จะถูกเพิ่มขึ้นมาแล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-g4kJnn2-m5mRtf1ftnNGw.png" /></figure><p>ในส่วนของ Filename ซึ่งเราจะกำหนดให้มันสร้างค่าอัตโนมัติแต่เราต้องทราบก่อนว่า appsheet มันเก็บข้อมูลเราไว้ที่ไหน โดยคลิกที่ Tab Info Properties แล้วดูที่ Default app Folder ให้ทำการ copy มา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rzp2o3-4LAxz1RSwpqdv_Q.png" /></figure><p>กลับไปที่ Tab Data โดยคลิกที่ Formula</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SwEl1eIko1t5iF5H0FAx8A.png" /></figure><p>แล้วให้เราใส่สูตรตามนี้เลย</p><p>“”ไดร์ฟของฉัน/appsheet/data/Demo-3924550/Files/DamageReport-” &amp; [Row ID] &amp; “.pdf””</p><p>โดย /appsheet/data/Demo-3924550 คือที่เราไป copy มา<br>“DamageReport-” คือ ชื่อไฟล์ที่เป็น Prefix<br>[_RowNumber] คือเลขแถวที่ไม่ซ้ำ แล้วตามด้วย .pdf ที่เป็นนามสกุลไฟล์ที่เราจะช้ จากนั้นกด บันทึก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*Gy-7hcraueEb7ECLVp74rg.png" /></figure><p>Field ไหนที่จำเป็นต้องมีก็อย่าลืม tick ที่ Key ไม่งั้นข้อมูลจะไม่ครบ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EGXnUTxZAjxrfY973Whz2Q.png" /></figure><p>บันทึก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*pGxWUK2okgl4zI0BwSnACQ.png" /></figure><p>มาทำ View กันดีกว่า มาที่ Tab UX ตรง For this data เปลี่ยนเป็น DamageReport</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0DkvTb7D8Piyc4bjQ6KFg.png" /></figure><p>ตรง app preview เราจะแสดง Live ขึ้นมาให้ดูจะเห็นว่ามันไม่ค่อยน่าดูเท่าไหร่</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*ObAB96NYrUau6acYMXtE_Q.png" /></figure><p>ให้เราปรับปรุงโดย เลื่อนหน้าเว็บไปล่างสุดจะพบปุ่ม Show system view</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IKWlgmT0dhRGwnjYinlwbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pq1K5i9-P4BK4IxNDnQAiw.png" /></figure><p>ให้เราไปที่ Column order แล้วลบ Filename ออก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*j3NKw1ySjBhPzE6fAijPcw.png" /></figure><p>หน้า Form จะไม่แสดง Filename แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*zNdPLk-iBIRAIov5qcFfTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*2uJrizg1pHNwwAkh0vSuBA.png" /></figure><p>กลับไป Tab Data หน้า View Report เพิ่อทำการ Regenertate อีกครั้ง จะเห็นว่ามี warning เตือนว่าข้อมูลไม่ได้ Sysnc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6OROlcrBUgY6_6ZMg2UroA.png" /></figure><p>หลังจาก sync เรียบร้อย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ObagQqLtpZfSN_KcU305Ng.png" /></figure><p>ทำการ Key ข้อมูลเพิ่มเข้าไปจากหน้า View</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*18Z6ngmEscPpLJlnekLCUw.png" /></figure><p>เมื่อกด Save จะกลับเข้าหน้า Llist เหมือนเดิม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*ym4qHgEZ_ns0InHkXcyd1Q.png" /></figure><p>ที่นี้เราลองกลับไปดูที่ Tab Data กันว่าข้อมูลที่เข้ามาเป็นอย่างที่คิดไหม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0qdzocOseL84_ewFEtLVA.png" /></figure><p>จะเห็นว่า ระบบสร้างชื่อไฟล์อัตโนมัติให้เรียบร้อย สบายใจละที่นี้ก็ให้นำเอา Link ตรงนี้ไปแสดงผลที่หน้า Detail โดยกลับไปที่ Tab UX แล้วคลิกที่ Detail</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YXZi894DKZJUr2Xjaw3GVQ.png" /></figure><p>จะพบว่ามี Link เป็นรูปขึ้นมาแล้วครับ แต่รู้สึกว่า Computer key ไม่ขึ้นมาเลย แต่เราสามารถจัดการได้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*9vp6Nd6fqeuiGm7mOcMesg.png" /></figure><p>ตรง Column Order คลิกรูปดินสอที่ _ComputedKey</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*7Ni_C9T9VllZfQkaLuJeDQ.png" /></figure><p>กด Delete</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*EhOGopOmPU4z8tGiqoTBOg.png" /></figure><p>กด Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*pAdmlMBJBDADPcxCD6ZOww.png" /></figure><p>เท่านี้ก็ได้แล้วครับเพียงแต่ไฟล์ที่แสดงนั้นไม่มีอยู่จริงเพราะเราไม่ได้สร้าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*iZkMWWD0CWG2vqxe9yvnZA.png" /></figure><p>ให้เราเข้าไปที่ Tab Automation แล้วคลิ๊กที่ New Bot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzubwaViP3APUMf1TRo7CQ.png" /></figure><p>ใส่ชื่อ Bot แล้วกด Create a new bot เช่นผมตั้งชื่อว่า “DBOT”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*UrH1F5imzSd0X7Jd4fDvlg.png" /></figure><p>กด Configure event</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TXJA8nXjtVW1TdxE80iTNQ.png" /></figure><p>ตั้งชื่อแล้วกด Create a new event</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*cSFu6uYWBii99vOhsW4QEg.png" /></figure><p>ตั้งค่าให้ event Source เป็น App</p><p>Data change Type เป็น Adds ,Updates</p><p>ตั้งค่า Byppass Security Filtter เป็น True</p><p>จากนั้นกด Add a step</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w0zlVnV1ffINAb-rVOTBQg.png" /></figure><p>ตั้งชื่อ Step แล้วกด Create a new step</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*3aRo7upzKvyff4GdTulmiA.png" /></figure><p>คลิกที่ Card Create PDF ฝั่งขวา ให้เลือก เป็น Create a new file</p><p>Http content type เป็น PDF แล้วกด ปุ่ม Create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kzuRnecaeVr_-3FJehLV-g.png" /></figure><p>จะได้ไฟล์ Template สำหรับเอกสารออกมาให้เราคลิก View เพื่อแก้ไขใน Google Doc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*tdRMA-fCFKRo_NVbghbtow.png" /></figure><p>ตรง &lt;&lt;[]&gt;&gt; เป็นชื่อ Field ถ้าหากต้องการเปลี่ยนต้องเปลี่ยนให้ตรงกับชื่อ Field ที่มีอยู่จริง ส่วนข้อความปรับได้ทั้งหมด แทรก Log แทรกอะไรได้ เมื่อแก้ไขเสร็จแล้วกด ปิดได้เลยครับมัน save อัตโนมัติ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*l-Y9fkwapE0BzM3VGmiBxQ.png" /></figure><p>เลื่อนลงมาตรง</p><p>ตรง Disable Timestamp</p><p>เลือก True</p><p>Attachment Page Orientation</p><p>เลือก Portrait</p><p>Attachment Page Size</p><p>เลือก เป็น A4</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*cgCaxNXZqFgywQJ17meboQ.png" /></figure><p>ตรง Filename Prefix ให้คลิกแล้วใส่สูตรครับ “DamageReport-” &amp; [_RowNumber] &amp; “.pdf”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*1AuDxC0FGddcT5EOmaeNhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*hehFzZmNMIgr76voCLinBA.png" /></figure><p>จากนั้น กด Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*iHZzM6Mskwy995Xw0qjBrA.png" /></figure><p>จากนั้นให้เรากลับไปที่หน้า UX แล้วลองแก้ไขข้อมูลใน Form ของเราดูครับ หลัง update แล้วก็จะมี icon ขึ้นฝั่งขวา</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*_AlSO2giJvo5S4pI6Q9KNg.png" /></figure><p>เมื่อลองคลิ๊กก็จะเป็น PDF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfbKQ-9vUc8vcfZ56VbdRA.png" /></figure><p>หากไม่สามารถสร้าง report ได้ให้มาดูที่ tab automation เลือก Monitor</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mpYhVmUcVjzlQ6EvjqeBCg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Vy-4UJ6xfKZ65pSIgmoMQ.png" /></figure><p>หากต้องการนำรายงานไปแล้วหลายๆอันพร้อมกันก็สามารถเข้าไปเอาได้ที่ Google Drive โดยเข้าไปที่ appsheet -&gt;data-&gt;ชื่อ app ตามด้วยตัวเลข-&gt; ไฟล์</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aBgSSWQMWadA-gjh0w9FKQ.png" /></figure><p>เรียบร้อยครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b853e1c9b0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup NextJs 15 Prisama API support x-www-form-urlencoded and Raw for MySQL ตอนที่ 2]]></title>
            <link>https://farmonline.medium.com/setup-nextjs-15-prisama-api-support-x-www-form-urlencoded-and-raw-for-mysql-%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88-2-6fb4aa64d7bb?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fb4aa64d7bb</guid>
            <category><![CDATA[raw]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[x-www-form-urlencoded]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Sun, 18 May 2025 17:26:15 GMT</pubDate>
            <atom:updated>2025-05-18T23:48:19.426Z</atom:updated>
            <content:encoded><![CDATA[<p>ระบบ BACKEND</p><ul><li>GET /api/posts สำหรับดึง Post ทั้งหมดออก</li><li>GET /api/posts/:id สำหรับดึง Post ออกมาตาม id</li><li>POST /api/posts สำหรับสร้าง Post</li><li>PUT /api/posts/:id สำหรับแก้ไข Post ตาม id</li><li>DELETE /api/posts/:id สำหรับลบ Post ตาม id</li></ul><h3>1. Add a new API Folder</h3><p>เพิ่ม Folder api ใน Folder app</p><h3>2. Add a new Post Folder</h3><p>เพิ่ม Folder POSTS ใน Folder api</p><p>แล้วเพิ่มหน้าroute.tsแล้วเพิ่ม code เข้าไป</p><pre>mkdir -p app/api &amp;&amp; touch app/api/route.ts</pre><pre><br>import { PrismaClient } from &quot;@/app/generated/prisma&quot;;<br><br><br>const prisma = new PrismaClient()<br><br>export async function GET() {<br>  return Response.json(await prisma.post.findMany())<br>}<br><br>export async function POST(req: Request) {<br>  try {<br><br>    const contentType = req.headers.get(&quot;content-type&quot;) || &quot;&quot;;<br><br>    let title: string | null = null;<br>    let content: string | null = null;<br><br>    if (contentType.includes(&quot;application/json&quot;)) {<br>      const body = await req.json();<br>      title = body.title;<br>      content = body.content;<br>    } else if (contentType.includes(&quot;application/x-www-form-urlencoded&quot;)) {<br>      const formData = await req.text();<br>      const params = new URLSearchParams(formData);<br>      title = params.get(&#39;title&#39;);<br>      content = params.get(&#39;content&#39;);<br>    } else {<br>      return new Response(&quot;Unsupported Content-Type&quot;, { status: 415 });<br>    }<br><br>    if (!title || !content) {<br>      return new Response(&quot;Missing title or content&quot;, { status: 400 });<br>    }<br><br>    const newPost = await prisma.post.create({<br>      data: {<br>        title,<br>        content,<br>        authorId: 1,<br>      },<br>    })<br>    <br>    return Response.json(newPost)<br>  } catch (error) {<br>    return new Response(error as BodyInit, {<br>      status: 500,<br>    })<br>  }<br>}</pre><p>เปิด Postman แล้วใส่ URL <a href="http://localhost:3000/api/posts">http://localhost:3000/api/posts</a> ก็จะได้ผลลัพธ์ดังนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WTYZdBbn1GxEnd9ky-QLEA.png" /></figure><h3>3. Add a new [id] Folder</h3><p>เพิ่ม api สำหรับ จัดการ update delete</p><p>เพิ่ม Folder [id] ใน Folder post</p><p>แล้วเพิ่มหน้าroute.tsแล้วเพิ่ม code เข้าไป</p><pre>import { PrismaClient } from &quot;@/app/generated/prisma&quot;;<br>import { NextRequest } from &quot;next/server&quot;;<br><br><br>const prisma = new PrismaClient()<br><br>export async function GET(<br>  req: Request,<br>  { params }: { params: { id: string } },<br>) {<br>  return Response.json(await prisma.post.findUnique({<br>    where: { id: Number(params.id) },<br>  }))<br>}<br><br>export async function PUT(<br>  req: Request,<br>  { params }: { params: { id: string } }<br>) {<br>  try {<br>    const text = await req.text();<br>    const formData = new URLSearchParams(text);<br>    const title = formData.get(&#39;title&#39;) ?? &#39;&#39;;<br>    const content = formData.get(&#39;content&#39;) ?? &#39;&#39;;<br><br>    const updatedPost = await prisma.post.update({<br>      where: { id: Number(await params.id) }, <br>      data: { title, content },<br>    });<br><br>    return Response.json(updatedPost);<br>  } catch (error) {<br>    return new Response(&#39;Error: &#39; + (error as Error).message, {<br>      status: 500,<br>    });<br>  }<br>}<br>export async function DELETE(<br>  req: Request,<br>  { params }: { params: { id: string } },<br>) {<br>  try {<br>    return Response.json(await prisma.post.delete({<br>      where: { id: Number(params.id) },<br>    }))<br>  } catch (error) {<br>    return new Response(error as BodyInit, {<br>      status: 500,<br>    })<br>  }<br>}</pre><p><strong>Method GET </strong><br>URL : localhost:3000/api/posts/1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*C28OOPP0J2X8qmZ6yMxyUQ.png" /></figure><p>จะแสดง 1 รายการตามเลขที่ระบุ</p><p><strong>Method</strong> <strong>PUT</strong></p><p>URL : localhost:3000/api/posts/1<br>ใส่ Body เลือกเป็น Raw แล้วใส่ ตามภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*DNeXUAm0sOFSclLjkL-jUQ.png" /></figure><p><strong>Method</strong> DELETE</p><p>URL : localhost:3000/api/posts/1<br>ใส่ Body เลือกเป็น Raw แล้วใส่ ตามภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*Re1rv41RB0QTJoTH-aB_TA.png" /></figure><p>เท่านี้ก็เรียบร้อย สำหรับการเรียกแบบ Raw</p><p>จาก code ด้านล่างแสดงให้เห็นว่า สามารถเลือกใช้ API ได้หลากหลายโดยการกำหนด ContentType แบ่งออกเป็น<br>1. application/json ซึ่งก็คือ Raw จะป้อน body แบบ ใช้ { }</p><p>2. application/x-www-form-urlencoded จะสามารถใส่ใน form ของ postman ได้ตรงๆ</p><pre>if (contentType.in cludes(&quot;application/json&quot;)) {<br>      const body = await req.json();<br>      title = body.title;<br>      content = body.content;<br>    } else if (contentType.includes(&quot;application/x-www-form-urlencoded&quot;)) {<br>      const formData = await req.text();<br>      const params = new URLSearchParams(formData);<br>      title = params.get(&#39;title&#39;);<br>      content = params.get(&#39;content&#39;);<br>    } else {<br>      return new Response(&quot;Unsupported Content-Type&quot;, { status: 415 });<br><br>    }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*mF60jpodNvlIHwDBMD9kfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*cLKtndV2l3PYsOSTCyBPuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*venB5A7aOIUTozVV9OaNGg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fb4aa64d7bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup NextJs 15 Prisama API support x-www-form-urlencoded and Raw for MySQL ตอนที่ 1]]></title>
            <link>https://farmonline.medium.com/setup-nextjs-15-prisama-api-support-x-www-form-urlencoded-and-raw-for-mysql-2394b241d71d?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2394b241d71d</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[x-www-form-urlencoded]]></category>
            <category><![CDATA[prisma]]></category>
            <category><![CDATA[nextjs-15]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Wed, 07 May 2025 10:50:29 GMT</pubDate>
            <atom:updated>2025-08-21T07:58:37.345Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Set up your project</h3><p>เข้า Powershell แล้วพิมพ์คำสั่งcreate-next-app</p><pre>npx create-next-app@latest my-prisma-app</pre><p>จะมี Option ให้เราเลือกลง ให้เลือกดังนี้:</p><ul><li>TypeScript : Yes</li><li>ESLint : None</li><li>Tailwind CSS : Yes</li><li>No src directory : No</li><li>App Router : Yes</li><li>Turbopack : Yes</li><li>No customized import alias : No</li></ul><p>เมื่อรอจน Success! แล้วก็ Cd เข้า my-prisma-app</p><blockquote>Creating a new Next.js app in C:\Users\piyanat\my-prisma-app.</blockquote><blockquote>Using npm.</blockquote><blockquote>Initializing project with template: app-tw</blockquote><blockquote>Installing dependencies:<br>- react<br>- react-dom<br>- next</blockquote><blockquote>Installing devDependencies:<br>- typescript<br>- <a href="http://twitter.com/types/node">@types/node</a><br>- <a href="http://twitter.com/types/react">@types/react</a><br>- <a href="http://twitter.com/types/react-dom">@types/react-dom</a><br>- <a href="http://twitter.com/tailwindcss/postcss">@tailwindcss/postcss</a><br>- tailwindcss</blockquote><blockquote>added 48 packages, and audited 49 packages in 54s</blockquote><blockquote>9 packages are looking for funding<br> run `npm fund` for details</blockquote><blockquote>found 0 vulnerabilities<br>Initialized a git repository.</blockquote><blockquote>Success! Created my-prisma-app at C:\Users\piyanat\my-prisma-app</blockquote><pre>cd my-prisma-app.</pre><h3>2. Set up Prisma ORM</h3><h3>2.1 Install Prisma ORM<a href="https://www.prisma.io/docs/guides/nextjs#21-install-prisma-orm">​</a></h3><p>Copy คำสั่งไป Run ใน Powershell</p><pre>npm install prisma tsx --save-dev<br>npm install @prisma/client</pre><h3>2.2 Set up Prisma MySQL and create your first models<a href="https://www.prisma.io/docs/guides/nextjs#22-set-up-prisma-postgres-and-create-your-first-models">​</a></h3><p>run คำสั่ง npx prisma init</p><pre>npx prisma init --db --output ../app/generated/prisma</pre><p>*** ระวังหน่อย ตัวอย่างเก่าๆ ใน schema.prisma นั้น จะไม่มี บรรทัดนี้<br>output = “../app/generated/prisma” ทำให้มันเอาไปไว้ใน node_Module (Version 7 ไม่รองรับแล้ว) ถ้าวางผิดที่หรือเปลี่ยนที่ก็ต้องไปตามเปลี่ยน path ที่อ้างอิง prismaclient</p><p>npm install <a href="http://twitter.com/prisma/client">@prisma/client</a></p><p>added 1 package, and audited 65 packages in 4s</p><p>11 packages are looking for funding<br> run `npm fund` for details</p><p>found 0 vulnerabilities<br>PS C:\Users\piyanat\my-prisma-app&gt; npx prisma init — db — output ../app/generated/prisma<br>This will create a project for you on console.prisma.io and requires you to be authenticated.<br>√ Would you like to authenticate? Yes<br>√ Select an authentication method Google<br>Authenticating to Prisma Platform via browser.</p><p>Visit the following URL in your browser to authenticate:<br><a href="https://console.prisma.io/auth/cli?state=eyJjbGllbnQiOiJwcmlzbWEtY2xpLzYuNy4wIChTaWduYXR1cmU6IGZkNGZiOGIwLTA5NzgtNGZiMS04NGI5LTI0NDU4Y2Y1ODU0NikiLCJjb25uZWN0aW9uIjoiZ29vZ2xlIiwicmVkaXJlY3RUbyI6Imh0dHA6Ly8xMjcuMC4wLjE6NTkzMjIvIn0%3D">https://console.prisma.io/auth/cli?state=eyJjbGllbnQiOiJwcmlzbWEtY2xpLzYuNy4wIChTaWduYXR1cmU6IGZkNGZiOGIwLTA5NzgtNGZiMS04NGI5LTI0NDU4Y2Y1ODU0NikiLCJjb25uZWN0aW9uIjoiZ29vZ2xlIiwicmVkaXJlY3RUbyI6Imh0dHA6Ly8xMjcuMC4wLjE6NTkzMjIvIn0%3D</a><br>Successfully authenticated as <a href="/service/mailto:farmonline@gmail.com"><strong>farmonline@gmail.com</strong></a><strong>.</strong><br>Let’s set up your Prisma Postgres database!<br>√ Select your region: <strong>ap-northeast-1 — Asia Pacific (Tokyo)</strong><br>? Enter a project name: <strong>my-prisma-app<br></strong>√ Success! Your Prisma Postgres database is ready ✅</p><p>We created an initial schema.prisma file and a .env file with your DATABASE_URL environment variable already set.</p><p>— — Next steps — -</p><p>Go to <a href="https://pris.ly/ppg-init">https://pris.ly/ppg-init</a> for detailed instructions.</p><p>1. Define your database schema<br>Open the schema.prisma file and define your first models. Check the docs if you need inspiration: <a href="https://pris.ly/ppg-init">https://pris.ly/ppg-init</a>.</p><p>2. Apply migrations<br>Run the following command to create and apply a migration:<br>npx prisma migrate dev — name init</p><p>3. Manage your data<br>View and edit your data locally by running this command:<br>npx prisma studio</p><p>…or online in Console:<br><a href="https://console.prisma.io/cmadk2pry00grg70ugj7laqmo/cmadk6qv2000cn3ufkp1ihenw/cmadk6qv2000dn3ufupygvinc/studio">https://console.prisma.io/cmadk2pry00grg70ugj7laqmo/cmadk6qv2000cn3ufkp1ihenw/cmadk6qv2000dn3ufupygvinc/studio</a></p><p>4. Send queries from your app<br>To access your database from a JavaScript/TypeScript app, you need to use Prisma ORM. Go here for step-by-step instructions: <a href="https://pris.ly/ppg-init">https://pris.ly/ppg-init</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujtvPjHEZdiqeLju3gWePA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBMoUVBAOfCwJnXjC3WkVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*4dm6W_c4KH1c0VxpDALI7A.png" /></figure><p>Select your region: <strong>ap-northeast-1 — Asia Pacific (Tokyo)</strong></p><p>Enter a project name: <strong>my-prisma-app</strong></p><p>หลังจากนั้นใน Project จะมี Folder ขึ้นมาชื่อว่า Prisma</p><blockquote>สิ่งที่ต้องมีคือมี Localhost จะใช้ Xampp หรือ ถ้าไม่มีจะใช้ host จริงก็แล้วแต่ เปลี่ยนให้ตรงกับของตัวเองได้เลย ทั้ง host user password port</blockquote><blockquote>ตั้งชื่อ ฐานข้อมูล mydb เตรียมไว้เลย</blockquote><p>ใน Folder มีไฟล์ .env ให้เราใส่ URLของ ฐานข้อมูล</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3IewiWv5B0Dn9SzQ2FRGpA.png" /></figure><p>ในตัวอย่างจะเป็น<br> DATABASE_URL=”mysql://username:password@localhost:3306/mydb”</p><p>ต่อไป ในไฟล์ schema.prisma เพิ่ม User model กับ Post model: ลงใน File prisma/schema.prisma เพื่อใช้</p><p>prisma/schema.prisma<br>เพิ่มในส่วนที่เน้นตัวหนาไว้</p><pre>generator client {<br>  provider = &quot;prisma-client-js&quot;<br>  output   = &quot;../app/generated/prisma&quot;<br>}<br>datasource db {<br>  provider = &quot;mysql&quot;<br>  url      = env(&quot;DATABASE_URL&quot;)<br>}</pre><pre><strong>model User {<br>  id    Int     @id @default(autoincrement())<br>  email String  @unique<br>  name  String?<br>  posts Post[]<br>}</strong></pre><pre><strong>model Post {<br>  id        Int     @id @default(autoincrement())<br>  title     String<br>  content   String?<br>  published Boolean @default(false)<br>  authorId  Int<br>  author    User    @relation(fields: [authorId], references: [id])<br>}</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*277Pz6M401prOeaGeyureg.png" /></figure><p>*** ตัวอย่างกรณีต้องการ Relation มากกว่า 1</p><pre><br>generator client {<br>  provider = &quot;prisma-client-js&quot;<br>  output   = &quot;../app/generated/prisma&quot;<br>}<br><br>datasource db {<br>  provider = &quot;postgresql&quot;<br>  url      = env(&quot;DATABASE_URL&quot;)<br>}<br><br>/* ---------- User ---------- */<br>model Users {<br>  username      String         @id            // ใช้ name เป็น Primary Key<br>  title        String?<br>  first_name    String?<br>  last_name     String?<br>  sex           String?<br>  role          Int            @default(1)    // 1 = User, 2 = Admin<br>  email         String         @unique<br>  password      String<br>  active        Boolean        @default(true)<br>  department_id Int<br>  user_image    String?<br>  created_at    DateTime       @default(now())<br>  updated_at    DateTime       @updatedAt<br><br>  tickets            Tickets[]      @relation(&quot;TicketCreatedBy&quot;)<br>  updatedTickets     Tickets[]      @relation(&quot;TicketUpdatedBy&quot;)<br>  ticketDetails      TicketDetail[] @relation(&quot;reply_user&quot;)<br>  departmentsCreated Departments[]  @relation(&quot;DepartmentCreatedBy&quot;)<br>  departmentsUpdated Departments[]  @relation(&quot;DepartmentUpdatedBy&quot;)<br>  ticketImages      TicketImage[]  // เพิ่ม<br>  ticketDetailImages TicketDetailImage[]  // เพิ่ม<br>  roles              Role?          @relation(fields: [role], references: [id])<br>  access_logs        AccessLogs[]      @relation(&quot;UserAccessLogs&quot;)<br>}<br><br>/* ---------- Department ---------- */<br>model Departments {<br>  id               Int       @id @default(autoincrement())<br>  department_name  String<br>  created_at       DateTime  @default(now())<br>  created_by       String<br>  updated_at       DateTime? @updatedAt<br>  updated_by       String?<br><br>  created_user          Users      @relation(&quot;DepartmentCreatedBy&quot;, fields: [created_by], references: [username])<br>  updated_user          Users?     @relation(&quot;DepartmentUpdatedBy&quot;, fields: [updated_by], references: [username])<br>  Ticket_department Tickets[]  @relation(&quot;Ticket_department&quot;)<br>  @@index([department_name])<br>  @@index([id])<br><br>}<br><br>/* ---------- Ticket Category ---------- */<br>model TicketCategory {<br>  id         Int      @id @default(autoincrement())<br>  category_name       String<br>  created_at DateTime @default(now())<br><br>  tickets    Tickets[]<br>}<br>/* ---------- Ticket Group ---------- */<br>model TicketGroup {<br>  id         Int      @id @default(autoincrement())<br>  group_name       String<br>  created_at DateTime @default(now())<br><br>  tickets    Tickets[]<br>}<br>/* ---------- Ticket Status ---------- */<br>model TicketStatus {<br>  id      Int      @id @default(autoincrement())<br>  code    Int      @unique<br>  name    String?<br>  tickets Tickets[]<br>  details TicketDetail[]<br>}<br>/* ---------- Role ---------- */<br>model Role {<br>  id      Int      @id @default(autoincrement())<br>  name    String?<br>  description String?<br>  users   Users[]<br>}<br>/* ---------- Ticket ---------- */<br>model Tickets {<br>  id                Int            @id @default(autoincrement())<br>  ticket_date       DateTime<br>  category_id       Int<br>  group_id          Int<br>  department_id     Int<br>  topic             String<br>  description       String<br>  assignee_id       String?<br>  start_date        DateTime?<br>  end_date          DateTime?<br>  duration_day      Int            @default(0)<br>  status_id         Int            @default(1)<br>  priority          Int            @default(1)<br>  created_at        DateTime       @default(now())<br>  updated_at        DateTime?      @updatedAt<br>  created_by        String<br>  updated_by        String?<br><br>  category           TicketCategory?  @relation(fields: [category_id], references: [id])<br>  group               TicketGroup?     @relation(fields: [group_id], references: [id])<br>  created_department Departments?     @relation(&quot;Ticket_department&quot;, fields: [department_id], references: [id])<br>  created_user       Users            @relation(&quot;TicketCreatedBy&quot;, fields: [created_by], references: [username])<br>  updated_user       Users?           @relation(&quot;TicketUpdatedBy&quot;, fields: [updated_by], references: [username])<br>  status             TicketStatus     @relation(fields: [status_id], references: [id])<br>  details            TicketDetail[]<br>  images             TicketImage[]        // เพิ่ม<br><br>  @@index([category_id])<br>  @@index([department_id])<br>  @@index([status_id])<br>  @@index([created_by])<br>  @@index([updated_by])<br>}<br><br>/* ---------- Ticket Detail ---------- */<br>model TicketDetail {<br>  id            Int           @id @default(autoincrement())<br>  ticket_id     Int<br>  reply_text    String?<br>  reply_user    String?<br>  replied_at    DateTime      @default(now())<br>  status_id     Int?<br><br>  ticket       Tickets       @relation(fields: [ticket_id], references: [id])<br>  user         Users?        @relation(&quot;reply_user&quot; ,fields: [reply_user], references: [username])<br>  status       TicketStatus? @relation(fields: [status_id], references: [id])<br>  images       TicketDetailImage[]       // เพิ่ม<br>  @@index([ticket_id])<br>  @@index([reply_user])<br>  @@index([status_id])<br>}<br><br>/* ---------- Ticket Images ---------- */<br>model TicketImage {<br>  id           Int       @id @default(autoincrement())<br>  ticket_id    Int<br>  url          String                     // URL ไฟล์ เช่น S3, MinIO, GCS<br>  filename     String?<br>  mime         String?<br>  size_bytes   Int?                        // ขนาดไฟล์หน่วยไบต์<br>  uploaded_at  DateTime  @default(now())<br>  uploaded_by  String<br><br>  ticket       Tickets   @relation(fields: [ticket_id], references: [id], onDelete: Cascade)<br>  uploader     Users     @relation(fields: [uploaded_by], references: [username])<br><br>  @@index([ticket_id])<br>  @@index([uploaded_by])<br>}<br><br>/* ---------- Ticket Detail Images (Reply Images) ---------- */<br>model TicketDetailImage {<br>  id               Int       @id @default(autoincrement())<br>  ticket_detail_id Int<br>  url              String<br>  filename         String?<br>  mime             String?<br>  size_bytes       Int?<br>  uploaded_at      DateTime  @default(now())<br>  uploaded_by      String<br><br>  detail           TicketDetail @relation(fields: [ticket_detail_id], references: [id], onDelete: Cascade)<br>  uploader         Users        @relation(fields: [uploaded_by], references: [username])<br><br>  @@index([ticket_detail_id])<br>  @@index([uploaded_by])<br>}<br><br><br>/* ---------- Ticket Detail Images (Reply Images) ---------- */<br>model AccessLogs {<br>  id                        Int       @id @default(autoincrement())<br>  access_logs_date_time     DateTime<br>  access_logs_user          String<br><br>  access_logs_users         Users        @relation(&quot;UserAccessLogs&quot;, fields: [access_logs_user], references: [username])<br>  @@index([access_logs_date_time])<br>  @@index([access_logs_user])<br>}<br><br></pre><h3>2.3 Update your database schema<a href="https://www.prisma.io/docs/guides/nextjs#23-update-your-database-schema">​</a></h3><p>นำเอาค่า Model ที่เราสร้างไปเพิ่มในฐานข้อมูลโดยคำสั่งprisma migrate dev</p><blockquote>***** ตารางเดิมในฐานจะหายหมด ถ้าเป็น ฐานจริง แล้วขึ้นว่า You may use prisma migrate reset to drop the development database.<br>All data will be lost. ให้เลิกทำทันที *****</blockquote><pre>npx prisma migrate dev --name init</pre><blockquote>Environment variables loaded from .env<br>Prisma schema loaded from prisma\schema.prisma<br>Datasource “db”: MySQL database “mydb” at “localhost:3306”</blockquote><blockquote>Applying migration `20250507065305_init`</blockquote><blockquote>The following migration(s) have been created and applied from new schema changes:</blockquote><blockquote>migrations/<br> └─ 20250507065305_init/<br> └─ migration.sql</blockquote><blockquote>Your database is now in sync with your schema.</blockquote><blockquote>✔ Generated Prisma Client (v6.7.0) to .\app\generated\prisma in 34ms</blockquote><p>หาก run คำสั่ง npx prisma db push ข้อมูลใน Table จะไม่หายแต่จะเป็นการนำเอา Model ที่อยู่ใน Schema ไปเพิ่มใน Table แทน</p><pre>npx prisma db push</pre><p>หาก run คำสั่ง npx prisma db pullจะดึงข้อมูลใน Table ที่มีทั้งหมดใน Database นั้นมาทำเป็น Model</p><pre>npx prisma db pull</pre><h3>2.4 Seed your database</h3><p>เป็นคำสั่ง โยนข้อมูลทดสอบลงไปในระบบ โดยจะโดยน Json ที่เตรียมไว้ไปใส่ ให้สร้างไฟล์ seed.ts ใน Folder prisma แล้ว copy code นี้ไปวาง<br>prisma/seed.ts</p><pre>import { PrismaClient, Prisma } from &#39;../app/generated/prisma&#39;<br>import { withAccelerate } from &#39;@prisma/extension-accelerate&#39;</pre><pre>const prisma = new PrismaClient().$extends(withAccelerate())</pre><pre>const userData: Prisma.UserCreateInput[] = [<br>  {<br>    name: &#39;Alice&#39;,<br>    email: &#39;alice@prisma.io&#39;,<br>    posts: {<br>      create: [<br>        {<br>          title: &#39;Join the Prisma Discord&#39;,<br>          content: &#39;https://pris.ly/discord&#39;,<br>          published: true,<br>        },<br>        {<br>          title: &#39;Prisma on YouTube&#39;,<br>          content: &#39;https://pris.ly/youtube&#39;,<br>        },<br>      ],<br>    },<br>  },<br>  {<br>    name: &#39;Bob&#39;,<br>    email: &#39;bob@prisma.io&#39;,<br>    posts: {<br>      create: [<br>        {<br>          title: &#39;Follow Prisma on Twitter&#39;,<br>          content: &#39;https://www.twitter.com/prisma&#39;,<br>          published: true,<br>        },<br>      ],<br>    },<br>  }<br>]</pre><pre>export async function main() {<br>  for (const u of userData) {<br>    await prisma.user.create({ data: u })<br>  }<br>}</pre><pre>main()</pre><p>เพิ่มคำสั่ง ใน package.json</p><pre>&quot;prisma&quot;: {<br>    &quot;seed&quot;: &quot;tsx prisma/seed.ts&quot;<br>  },</pre><p>package.json</p><pre>{<br>  &quot;name&quot;: &quot;my-app&quot;,<br>  &quot;version&quot;: &quot;0.1.0&quot;,<br>  &quot;private&quot;: true,<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;next dev --turbopack&quot;,<br>    &quot;build&quot;: &quot;next build&quot;,<br>    &quot;start&quot;: &quot;next start&quot;,<br>    &quot;lint&quot;: &quot;next lint&quot;<br>  },<br>  &quot;prisma&quot;: {<br>    &quot;seed&quot;: &quot;tsx prisma/seed.ts&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;@prisma/client&quot;: &quot;^6.7.0&quot;,<br>    &quot;@prisma/extension-accelerate&quot;: &quot;^1.3.0&quot;,<br>    &quot;next&quot;: &quot;15.3.1&quot;,<br>    &quot;react&quot;: &quot;^19.0.0&quot;,<br>    &quot;react-dom&quot;: &quot;^19.0.0&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;@eslint/eslintrc&quot;: &quot;^3&quot;,<br>    &quot;@tailwindcss/postcss&quot;: &quot;^4&quot;,<br>    &quot;@types/node&quot;: &quot;^20&quot;,<br>    &quot;@types/react&quot;: &quot;^19&quot;,<br>    &quot;@types/react-dom&quot;: &quot;^19&quot;,<br>    &quot;eslint&quot;: &quot;^9&quot;,<br>    &quot;eslint-config-next&quot;: &quot;15.3.1&quot;,<br>    &quot;prisma&quot;: &quot;^6.7.0&quot;,<br>    &quot;tailwindcss&quot;: &quot;^4&quot;,<br>    &quot;tsx&quot;: &quot;^4.19.4&quot;,<br>    &quot;typescript&quot;: &quot;^5&quot;<br>  }<br>}</pre><p>run npx prisma db seed</p><pre>npx prisma db seed</pre><p>ลองเปิดที่ Database ก็จะพบว่าตารางที่ว่างเปล่าเหล่านั้นมันถูกเติมแล้ว</p><h3>2.5 Set up Prisma Client<a href="https://www.prisma.io/docs/guides/nextjs#25-set-up-prisma-client">​</a></h3><p>สร้าง Folder lib ไว้นอกสุดแล้วเพิ่มไฟล์ prisma.ts เข้าไปด้วยคำสั่ง</p><pre>mkdir -p lib &amp;&amp; touch lib/prisma.ts</pre><p>เพิ่ม code ในlib/prisma.ts</p><pre><em>import</em> { PrismaClient } <em>from</em> &#39;@/app/generated/prisma&#39;<br><br><em>const</em> globalForPrisma = global <em>as</em> unknown <em>as</em> { <br>    prisma: PrismaClient<br>}<br><br><em>const</em> prisma = globalForPrisma.prisma || <em>new</em> PrismaClient()<br><br><em>if</em> (process.env.NODE_ENV !== &#39;production&#39;) globalForPrisma.prisma = prisma<br><br><em>export</em> <em>default</em> prisma</pre><p>แก้ไขไฟล์ globals.css ลบให้เหลือแค่</p><pre>@import &quot;tailwindcss&quot;;</pre><h3>3. Query your database with Prisma ORM<a href="https://www.prisma.io/docs/guides/nextjs#3-query-your-database-with-prisma-orm">​</a></h3><p>มาลองดึงข้อมูลดู</p><p>สร้างไฟล์ page.tsx ใน Folder app จะได้ Path app/page.tsx <br>แล้ววาง code นี้ลงไป</p><pre>import prisma from &#39;@/lib/prisma&#39;<br>export default async function Home() {<br>  const users = await prisma.user.findMany();<br>  return (<br>    &lt;div className=&quot;min-h-screen bg-gray-50 flex flex-col items-center justify-center -mt-16&quot;&gt;<br>      &lt;h1 className=&quot;text-4xl font-bold mb-8 font-[family-name:var(--font-geist-sans)] text-[#333333]&quot;&gt;<br>        Superblog<br>      &lt;/h1&gt;<br>      &lt;ol className=&quot;list-decimal list-inside font-[family-name:var(--font-geist-sans)]&quot;&gt;<br>        {users.map((user) =&gt; (<br>          &lt;li key={user.id} className=&quot;mb-2&quot;&gt;<br>            {user.name}<br>          &lt;/li&gt;<br>        ))}<br>      &lt;/ol&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>ระวัง import prisma from ‘@/lib/prisma’ เอาไว้ให้ดี ว่าเราวาง lib ไว้ที่ไหน สมมุติว่าไม่ได้วางที่ root ไปวางที่ app แทน ให้ ‘@/app/lib/prisma’ แทน</p><p>ลอง run ดูก็พบว่าหน้าแรก ของเรามีรายการ User แสดงขึ้นมาแล้ว ด้วยคำสั่ง <br>const users = await prisma.user.findMany();</p><ul><li>*** ขั้นตอนนี้ถ้า prisma มัน error ให้สันนิฐานว่า import prisma from ‘@/lib/prisma’ อันนี้ link ไม่ถูก</li><li>**** ถ้าพิมพ์ prisma จุด แล้ว auto complete ไม่ขึ้นให้ลองใช้คำสั่ง <br>npx prisma generate</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vztvO-L28QhfEXSl-Q_WPw.png" /></figure><h3>4. Add a new Posts list page<a href="https://www.prisma.io/docs/guides/nextjs#4-add-a-new-posts-list-page">​</a></h3><p>เพิ่มหน้าสำหรับรายการ Post</p><p>เพิ่ม Folder posts ใน Folder app แล้วเพิ่มหน้าpage.tsxแล้วเพิ่ม code เข้าไป</p><pre>mkdir -p app/posts &amp;&amp; touch app/posts/page.tsx</pre><pre><br>import prisma from &quot;@/lib/prisma&quot;;<br><br>export default async function Posts() {<br>  const posts = await prisma.post.findMany({<br>    include: {<br>      author: true,<br>    },<br>  });<br><br>  return (<br>    &lt;div className=&quot;min-h-screen bg-gray-50 flex flex-col items-center justify-center -mt-16&quot;&gt;<br>      &lt;h1 className=&quot;text-4xl font-bold mb-8 font-[family-name:var(--font-geist-sans)] text-[#333333]&quot;&gt;<br>        Posts<br>      &lt;/h1&gt;<br>      &lt;ul className=&quot;font-[family-name:var(--font-geist-sans)] max-w-2xl space-y-4&quot;&gt;<br>        {posts.map((post) =&gt; (<br>          &lt;li key={post.id}&gt;<br>            &lt;span className=&quot;font-semibold&quot;&gt;{post.title}&lt;/span&gt;<br>            &lt;span className=&quot;text-sm text-gray-600 ml-2&quot;&gt;<br>              by {post.author.name}<br>            &lt;/span&gt;<br>          &lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oe6v74omQMall3fNKPH7Qg.png" /></figure><h3>5. Add a new Posts detail page<a href="https://www.prisma.io/docs/guides/nextjs#5-add-a-new-posts-detail-page">​</a></h3><p>แสดงรายละเอียดรายการ Post ตาม ID</p><p>ใน Folder posts สร้าง Folder[id] แล้วเพิ่มหน้า page.tsx</p><pre>mkdir -p app/posts/[id] &amp;&amp; touch app/posts/[id]/page.tsx</pre><pre>import prisma from &quot;@/lib/prisma&quot;;<br>import { notFound } from &quot;next/navigation&quot;;<br><br>export default async function Post({ params }: { params: Promise&lt;{ id: string }&gt; }) {<br>  const { id } = await params;<br>  const post = await prisma.post.findUnique({<br>    where: { id: parseInt(id) },<br>    include: {<br>      author: true,<br>    },<br>  });<br><br>  if (!post) {<br>    notFound();<br>  }<br><br>  return (<br>    &lt;div className=&quot;min-h-screen bg-gray-50 flex flex-col items-center justify-center -mt-16&quot;&gt;<br>      &lt;article className=&quot;max-w-2xl space-y-4 font-[family-name:var(--font-geist-sans)]&quot;&gt;<br>        &lt;h1 className=&quot;text-4xl font-bold mb-8 text-[#333333]&quot;&gt;{post.title}&lt;/h1&gt;<br>        &lt;p className=&quot;text-gray-600 text-center&quot;&gt;by {post.author.name}&lt;/p&gt;<br>        &lt;div className=&quot;prose prose-gray mt-8&quot;&gt;<br>          {post.content || &quot;No content available.&quot;}<br>        &lt;/div&gt;<br>      &lt;/article&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>ลองเรียก URL localhost:3000/posts/1 หรือlocalhost:3000/posts/2 ถ้าหาก ไม่พบจะขึ้น 404 Notfound โดยเรียก URL localhost:3000/posts/999.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*emOUYl4vBMTLwRlr0m9XcQ.png" /></figure><h3>6. Add a new Posts create page<a href="https://www.prisma.io/docs/guides/nextjs#6-add-a-new-posts-create-page">​</a></h3><p>สร้างหน้าสำหรับ เพิ่ม</p><pre>mkdir -p app/posts/new &amp;&amp; touch app/posts/new/page.tsx</pre><pre>import Form from &quot;next/form&quot;;<br>import prisma from &quot;@/lib/prisma&quot;;<br>import { revalidatePath } from &quot;next/cache&quot;;<br>import { redirect } from &quot;next/navigation&quot;;<br><br>export default function NewPost() {<br>  async function createPost(formData: FormData) {<br>    &quot;use server&quot;;<br><br>    const title = formData.get(&quot;title&quot;) as string;<br>    const content = formData.get(&quot;content&quot;) as string;<br><br>    await prisma.post.create({<br>      data: {<br>        title,<br>        content,<br>        authorId: 1,<br>      },<br>    });<br><br>    revalidatePath(&quot;/posts&quot;);<br>    redirect(&quot;/posts&quot;);<br>  }<br><br>  return (<br>    &lt;div className=&quot;max-w-2xl mx-auto p-4&quot;&gt;<br>      &lt;h1 className=&quot;text-2xl font-bold mb-6&quot;&gt;Create New Post&lt;/h1&gt;<br>      &lt;Form action={createPost} className=&quot;space-y-6&quot;&gt;<br>        &lt;div&gt;<br>          &lt;label htmlFor=&quot;title&quot; className=&quot;block text-lg mb-2&quot;&gt;<br>            Title<br>          &lt;/label&gt;<br>          &lt;input<br>            type=&quot;text&quot;<br>            id=&quot;title&quot;<br>            name=&quot;title&quot;<br>            placeholder=&quot;Enter your post title&quot;<br>            className=&quot;w-full px-4 py-2 border rounded-lg&quot;<br>          /&gt;<br>        &lt;/div&gt;<br>        &lt;div&gt;<br>          &lt;label htmlFor=&quot;content&quot; className=&quot;block text-lg mb-2&quot;&gt;<br>            Content<br>          &lt;/label&gt;<br>          &lt;textarea<br>            id=&quot;content&quot;<br>            name=&quot;content&quot;<br>            placeholder=&quot;Write your post content here...&quot;<br>            rows={6}<br>            className=&quot;w-full px-4 py-2 border rounded-lg&quot;<br>          /&gt;<br>        &lt;/div&gt;<br>        &lt;button<br>          type=&quot;submit&quot;<br>          className=&quot;w-full bg-blue-500 text-white py-3 rounded-lg hover:bg-blue-600&quot;<br>        &gt;<br>          Create Post<br>        &lt;/button&gt;<br>      &lt;/Form&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>ลองเรียก localhost:3000/posts/new แล้วกดปุ่ม Create Post</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*86T3lO3cIWQOdJzA-Q8fmg.png" /></figure><p>อ่านต่อ <a href="https://medium.com/@farmonline/setup-nextjs-15-prisama-api-support-x-www-form-urlencoded-and-raw-for-mysql-2394b241d71d">ตอนที่ 2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2394b241d71d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“นอกจากความพยายามแล้ว ฉันไม่มีพรสวรรค์ใด”]]></title>
            <link>https://farmonline.medium.com/%E0%B8%99%E0%B8%AD%E0%B8%81%E0%B8%88%E0%B8%B2%E0%B8%81%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%9E%E0%B8%A2%E0%B8%B2%E0%B8%A2%E0%B8%B2%E0%B8%A1%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7-%E0%B8%89%E0%B8%B1%E0%B8%99%E0%B9%84%E0%B8%A1%E0%B9%88%E0%B8%A1%E0%B8%B5%E0%B8%9E%E0%B8%A3%E0%B8%AA%E0%B8%A7%E0%B8%A3%E0%B8%A3%E0%B8%84%E0%B9%8C%E0%B9%83%E0%B8%94-53c3d374e56c?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/53c3d374e56c</guid>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Mon, 05 May 2025 11:46:51 GMT</pubDate>
            <atom:updated>2025-05-05T11:46:51.232Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wu7Y1ZP__5FVJTgK4YIEIw.png" /></figure><p>“นอกจากความพยายามแล้ว ฉันไม่มีพรสวรรค์ใด”</p><p>บางคนเกิดมาพร้อมพรสวรรค์<br>บางคนเรียนรู้เร็ว ทำอะไรก็ดูเหมือนง่าย<br>แต่สำหรับบางคน… คนอย่างฉัน<br>ไม่มีอะไรเลย นอกจาก “ความพยายาม”</p><p>ฉันไม่ใช่คนที่เก่งตั้งแต่เริ่มต้น<br>ฉันล้ม… ลุก… แล้วก็ล้มอีก<br>แต่ฉันก็ยังเลือกจะเดินต่อ เพราะฉันเชื่อว่า<br>“ความพยายามไม่ต้องซื้อ และความพยายามที่ไม่หยุดหย่อน <br>จะพาฉันไปได้ไกลกว่าใครหลายคนที่หยุดอยู่กับที่”</p><p>ในโลกที่คนส่วนใหญ่ชื่นชมพรสวรรค์<br>ฉันเลือกที่จะเชื่อใน “แรงศรัทธา” และ “ความอดทน”<br>เพราะทุกความสำเร็จของฉัน<br>ไม่ได้มาจากโชค ไม่ได้มาจากความเก่ง<br>แต่มาจากหยาดเหงื่อ… ความทุ่มเท… วันแล้วคืนเล่าที่แทบไม่มีใครเห็น</p><p>มีหลายครั้งที่ฉันคิดจะยอมแพ้ทุกครั้งที่ฉันพยายามทำอะไรใหม่ๆ<br>หลายครั้งที่เสียงในหัวตะโกนว่า “พอเถอะ มันไม่ใช่ทางของเรา ทำแค่ที่เราถนัดพอ”<br>แต่เสียงหนึ่งที่ดังกว่าเสมอ คือเสียงของหัวใจที่ยังอยากจะสู้<br>มันบอกว่า… “ขอแค่อีกก้าวเดียว อีกแค่นิดเดียว วันนี้ไม่ได้พรุ่งนี้ไม่แน่ แล้วค่อยว่ากัน”</p><p>จากคนธรรมดาที่ไม่มีอะไรโดดเด่น<br>ฉันเริ่มมีบางอย่าง… ไม่ใช่เพราะฉันเก่งกว่าคนอื่น<br>แต่เพราะฉันแค่ไม่หยุดพยายาม…<br>ยังพยายามต่อในวันที่คนอื่นล้มเลิกไปแล้ว<br>และฉันยินดีจะบอกว่าฉันก็ได้ความช่วยเหลือจากคนมากมาย<br>ที่มาเติมเต็มส่วนที่ฉันขาดหายไปจนผลักดันตัวเองมาถึงตรงนี้</p><p>ใครก็ตามที่กำลังท้อแท้<br>ใครก็ตามที่รู้สึกว่าตัวเองไม่เก่งพอ<br>จำไว้นะ…</p><p>พรสวรรค์อาจทำให้คุณวิ่งได้เร็วกว่าคนอื่น<br>แต่ความพยายามคือสิ่งที่จะพาคุณไปถึงเส้นชัย<br>ต่อให้ไม่ชนะใครๆ แต่อย่างน้อยๆก็พิสูจน์ว่าความพยายามนั้นไม่ได้ไร้ค่า</p><p>และถ้าวันนี้คุณไม่มีอะไรเลย… คุณไม่เก่ง… คุณไม่มีพรสวรรค์.. <br>จงมี “ความพยายาม” ให้มากพอ จนมันกลายเป็นพรสวรรค์ของคุณเอง</p><p>และเมื่อคุณทำสำเร็จ อย่าลืมตน ยกตนสูงส่ง ให้ช่วยคนที่ยังไม่หยุดพยายาม..<br>เพราะคงมีแต่คนแบบคุณเท่านั้นที่จะเข้าใจพวกเขา</p><p>✍️ “นอกจากความพยายามแล้ว ฉันไม่มีพรสวรรค์ใด… <br>แต่บางที นั่นก็อาจเป็นสุดยอดพรสวรรค์สำหรับคุณ”</p><p>ขอบคุณตัวฉันที่ไม่ยอมแพ้</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53c3d374e56c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เมื่อความพยายามไม่พาเราไปถึงฝั่ง…แต่เราก็ยังเดินต่อ]]></title>
            <link>https://farmonline.medium.com/%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1%E0%B8%9E%E0%B8%A2%E0%B8%B2%E0%B8%A2%E0%B8%B2%E0%B8%A1%E0%B9%84%E0%B8%A1%E0%B9%88%E0%B8%9E%E0%B8%B2%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B9%84%E0%B8%9B%E0%B8%96%E0%B8%B6%E0%B8%87%E0%B8%9D%E0%B8%B1%E0%B9%88%E0%B8%87-%E0%B9%81%E0%B8%95%E0%B9%88%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B8%81%E0%B9%87%E0%B8%A2%E0%B8%B1%E0%B8%87%E0%B9%80%E0%B8%94%E0%B8%B4%E0%B8%99%E0%B8%95%E0%B9%88%E0%B8%AD-a542e81c14d2?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a542e81c14d2</guid>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Tue, 29 Apr 2025 08:12:17 GMT</pubDate>
            <atom:updated>2025-04-29T08:13:07.626Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>อาชีพของผมคือ “โปรแกรมเมอร์”<br> หลายครั้งเวลาที่ต้องพัฒนาอะไรใหม่ ๆ ขึ้นมา มันแทบไม่เคยมีตัวอย่างที่ตรงกับความต้องการของเราซะทีเดียว เราต้องลองผิดลองถูก ฝึกฝน คอมไพล์โค้ดเป็นร้อย ๆ ครั้ง ทดสอบไม่รู้กี่รอบ บางทีมันก็ยังไม่ได้ ยังไม่ดีพอ</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fSOvRhbrX4XuM5TdrwAdSw.png" /></figure><p>แต่เวลาไม่เคยรอใคร<br> เราต้องทำให้มันเสร็จ ไม่ว่าจะต้องอ้อม ต้องแก้ขัด หรือต้องด้นสด<br> ตราบใดที่มันสำเร็จ วิธีการไม่สำคัญ</p><p>แม้จะทุ่มเทแค่ไหน ก็ยังมีวันที่มันตัน ทำต่อไม่ได้ จนหนทาง<br> แล้วก็ต้องยอมรับความจริงว่า มีคนอื่นทำได้ดีกว่าเรา เราไม่รู้เขาทำได้ยังไงด้วยซ้ำ<br> สำหรับเขา มันอาจเป็นเรื่องง่าย — แต่สำหรับเรา มันคือภูเขาอีกลูกที่ต้องปีน</p><p>ผมเคยคิดว่าถ้าพยายามมากพอ เราจะเป็นที่สุดได้<br> แต่วันนี้ผมรู้แล้วว่า “เหนือฟ้ายังมีฟ้า”<br> สิ่งที่เรารู้มันยังเล็กน้อย เมื่อเทียบกับสิ่งที่ยังไม่รู้</p><p>แต่นั่นแหละคือความงดงามของการเป็นโปรแกรมเมอร์<br> เพราะตราบใดที่ยังมีสิ่งที่ไม่รู้ — เราก็ยังมีเหตุผลให้ตื่นขึ้นมาทุกเช้า<br> เพื่อเขียนโค้ดอีกบรรทัด<br> เพื่อพยายามอีกครั้ง<br>ถ้าใจสู้ อุปสรรค ก็แค่เขาอีกลูกที่ต้องปีน</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a542e81c14d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Delphi Send Message To Telegram instead of Line Notify Part 3 Group Chat]]></title>
            <link>https://farmonline.medium.com/delphi-send-message-to-telegram-instead-of-line-notify-part-3-009b89310e46?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/009b89310e46</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[groups]]></category>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[telegram]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Fri, 07 Mar 2025 10:27:46 GMT</pubDate>
            <atom:updated>2025-03-07T10:29:25.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Pk0n0pEvALHXrDt-.png" /></figure><p>ในตอนที่ 3 นี่ เรามาเอา Bot เข้ากลุ่มกันเถอะ</p><p>ก่อนอื่นเลยก็สร้างกลุ่ม ขึ้นมาก่อน เลือก New Group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*_H5HBWbd_heq0sLz59WqKg.png" /></figure><p>ตั้งชื่อกลุ่ม แล้วเลือก Next</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*gtXaHjxftok1M2qGcX6O4A.png" /></figure><p>เพิ่มสมาชิกที่เป็น Bot เข้ามา ใส่ @ นำหน้า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*Y60NCNdzfnDw3VEXUDYLgg.png" /></figure><p>จะถามว่า เราจะให้เห็นข้อความก่อนหน้าหรือไม่ อันนี้แล้วแต่เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*TKShcaSnlGK1FegmWdBhwA.png" /></figure><p>กดที่ member จะเห็นว่ามี รายชื่อคือคนสร้างกลุ่ม กับ Bot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GKT1BlM8m-ST3hXexwZOyQ.png" /></figure><p>คลิกขวาที่ชื่อของ Bot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*9omeaEM78V1ga4Wk8Pme5A.png" /></figure><p>ปรับให้เป็น Admin ถ้าไม่ปรับจะไม่สามารถใช้ API เพื่อหา chat id ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*cK7I4Eo61MNmbvX9GVxFVA.png" /></figure><p>กดบันทึก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*LTIbPp-DGL3KAfM8SadYMA.png" /></figure><p>จะเห็นว่าถูกปรับเป็น Admin แล้ว</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*JbmAb9D3nbfzQqM3cpvcew.png" /></figure><p>พิมพ์ข้อความลงไปเพื่อจะได้ Run API เพื่อ หา ChatID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*w0iasiBMT5PG--JH16yVSg.png" /></figure><p>run API GetUpdate เพื่อหาค่า Chat ID (ดูได้จาก <a href="https://farmonline.medium.com/delphi-send-message-to-telegram-instead-of-line-notify-part-1-61caa9f3818e">ตอนแรก</a>) ถ้าได้มาจากกลุ่มจะเห็นว่า Chat ID เป็นค่าติดลบ และ Type เป็น Private</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R7a1l8TcP43db4qHlyAnDg.png" /></figure><p>Run API SendMessage (ดูได้จาก <a href="https://farmonline.medium.com/delphi-send-message-to-telegram-instead-of-line-notify-part-1-61caa9f3818e">ตอนแรก</a>) เพื่อทดสอบส่งข้อความ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ml8bw3HN8bE6jVQCowamsQ.png" /></figure><p>จะเห็นว่าสามารถส่งข้อความเข้ากลุ่มได้สำเร็จ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*tf208YV3W8kFowUp0gbGqQ.png" /></figure><p>หวังว่าจะเป็นประโยชน์นะครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=009b89310e46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Delphi Send Message To Telegram instead of Line Notify Part 2]]></title>
            <link>https://farmonline.medium.com/delphi-send-message-to-telegram-instead-of-line-notify-part-2-5be36c951952?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5be36c951952</guid>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[telegram-api]]></category>
            <category><![CDATA[telegram]]></category>
            <category><![CDATA[line-notify]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 14:51:47 GMT</pubDate>
            <atom:updated>2025-03-07T10:30:11.476Z</atom:updated>
            <content:encoded><![CDATA[<h3>Delphi Send Message To Telegram instead of Line Notify Part 2 Delphi Send API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*EDxiIZnkCKfULynG.png" /></figure><p>เอาละๆ มาถึงตอนที่สองที่ต้องใช้ Delphi ในการส่งก่อนอื่นเราต้องมารู้จักกับ <br>Rest Debuger ของ Delphi กันก่อน เจ้านี้คือ Tool ที่เอาไว้ทดสอบยิง API จาก Delphi แต่ความเจ๋งของมันคือ เมื่อเราทำการทดสอบเราสามารถ Copy Component มาวางใน Form ได้เลยไม่ต้องไปไล่ Properties เพื่อกำหนดค่าใหม่แต่อย่างใด โดยเราสามารถเรียกใช้ได้จาก เมนู Tools → REST Debugger</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*Bxy2hw0u61-1xplkDOECgA.png" /></figure><p>เราจะได้หน้าตาเหมือนรูปด้านล่าง ให้เรานำ URL ที่เหมือนกับที่เราใส่ใน Postman</p><p>Method เป็น GET ส่วน URL เป็น</p><p><a href="https://api.telegram.org/bot$apiToken/sendMessage">https://api.telegram.org/bot</a><a href="https://api.telegram.org/botYOUR_BOT_API_TOKEN/getUpdates"><strong>YOUR_BOT_API_TOKEN</strong></a><a href="https://api.telegram.org/bot$apiToken/sendMessage">/sendMessage</a></p><p>ตรง <a href="https://api.telegram.org/botYOUR_BOT_API_TOKEN/getUpdates"><strong>YOUR_BOT_API_TOKEN</strong></a><strong> </strong>ใส่ Token ที่ได้มา อย่าลบคำว่า <strong>bot </strong>ละ</p><p>ในส่วน Content-Type เลือก เป็น x-www-form-urlencoded</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-iIQZoM8A9Je_Xvji-UnrQ.png" /></figure><p>ในส่วนของ Parameters ให้กด Add แล้วใส่ตามรูป<br>โดยมี Param 2 ตัวคือ chat_id กับ text โดย<br>Kind เป็น Body <br>Name เป็น ชื่อ Param<br>Value เป็น ค่าที่ใส่<br>เลือก Do not encode แล้วกด Apply แล้วทดสอบโดยการกดปุ่ม Send Request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eOGYeZj0nR6Gsq2qd0MWng.png" /></figure><p>หากสำเร็จจะได้ผลลัพธ์แบบในรูปด้านล่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npItc5O1lteVSA5vpX5_8Q.png" /></figure><p>กดปุ่ม Copy Components เพื่อ Copy การตั้งค่าที่เราใช้ทดสอบไปกำหนดค่าใน Components</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*S1B7dLbfGeMt--3rMy7sCg.png" /></figure><p>นำไปกดวางใน form ก็จะได้หน้าตาประมาณนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*k2ByjHE-32yAFI89pNzD1w.png" /></figure><p>กำหนดหน้าตาของ form โดยใส่ช่องสำหรับกำหนด chat_id และ Text แล้วที่สำคัญปุ่มส่ง Request ให้ BOT ส่งเข้าช่องแชต</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*0_7j--q21L1yzFiQKDgV7A.png" /></figure><blockquote>ใส่ code เข้าไปเพื่อให้รับค่าจาก Textbox ไปส่ง API<br> RESTRequest1.Params.Items[0].Value := TxtChatID.Text;<br> RESTRequest1.Params.Items[1].Value := TxtMessage.Text;<br> RESTRequest1.Execute;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*hw46nWg9-6_4BrQXB9MwJQ.png" /></figure><p>เมื่อ Run โปรแกรมแล้วกด Send ก็จะมีข้อความขึ้นที่ Telegram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-cCwt_26Eg7PU4s29n1MSQ.png" /></figure><p>เป็นไงครับไม่ยากเนอะ เท่านี้ก็เป็นอันเรียร้อย</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5be36c951952" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Delphi Send Message To Telegram instead of Line Notify Part 1 Telegram Bot]]></title>
            <link>https://farmonline.medium.com/delphi-send-message-to-telegram-instead-of-line-notify-part-1-61caa9f3818e?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/61caa9f3818e</guid>
            <category><![CDATA[delphi]]></category>
            <category><![CDATA[line]]></category>
            <category><![CDATA[telegram]]></category>
            <category><![CDATA[messenging-bots]]></category>
            <category><![CDATA[line-notify]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 14:20:27 GMT</pubDate>
            <atom:updated>2025-03-10T03:21:24.938Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E5KerAd9-5C5zoH07nnM2Q.png" /><figcaption>เปลี่ยนมาใช้ Telegram แทน line notify กันเถอะ</figcaption></figure><p>Line notify กำลังจะหยุดให้บริการตั้งแต่วันที่ 1 เมษายน พ.ศ. 2568 ปีหน้าแล้ว มีทางเลือกอย่างน้อยสองทางคือเปลี่ยนไปใช้ <a href="https://developers.line.biz/en/services/messaging-api/">Line Messaging API</a> หรือ ไปลองหันไปใช้ <a href="https://core.telegram.org/bots/api">Telegram Bot</a> ในยุคสมัยที่ Bitcoin เฟื่องฟู NFT เกมส์ หรือ Play to Earn กำลังได้รับความนิยมถึงขึดสุด ก็คงต้องรู้จัก Telegram อย่างแน่นอน</p><p>เอาละมาเริ่มกันก่อนอื่นเลยคงต้อง Download <a href="https://telegram.org/">Telegram</a> มาใช้งานก่อน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ESjnyGNPFVefZX4r_3KTg.png" /></figure><p>หลักการมันเหมือนๆกันกับ Line Chat Bot สิ่งที่เราต้องมีคือ</p><ol><li>Bot Token</li><li>Chat_ID</li></ol><p>เริ่มต้นจากการสร้าง Bot และ เอาค่า token มาใช้ ไปกันเลย</p><p>หลังติดตั้งแล้วให้เราค้นหา account @BotFather</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*5KsCvoFV5LQFGbziVHALWg.png" /></figure><p>เมื่อ Double Click แล้วจะมีข้อความอัตโนมัติขึ้นมา ให้เราคลิกที่ <em>/newbot (Create a new bot)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*b-UZIvREUiZrdfqpjeYZkw.png" /></figure><p>ให้เราใส่ชื่อ BOT ที่เราต้องการแล้วให้ลงด้วยคำว่า BOT เพื่อสื่อความหมาย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*pXWQ9Om5cteFwkLIqZnDog.png" /></figure><p>ถ้าเราไม่ใส่ มันก็จะไม่ย๊อมมมมมม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*mTYF3d_MO2aDSRnyHGMyCQ.png" /></figure><p>ดังนั้นใส่ไปเถอะ แต่อย่าคิดว่าใส่อะไรไปก็ได้นะ ถ้ามันเป็นชื่อโหลๆ มันก็ไม่ work</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*2Ze9cjBQJZ7ITUWu-evBqg.png" /></figure><p>ดังนั้นคุณยังมีโอกาส ใส่ให้มันถูกเถอะพ่อคุณ ใส่ตัวเลขด้านหลังไป หรือ จะคิดคำที่คิดว่าจะไม่มีใครใช้ไปเรื่อยๆก็ไม่ว่ากัน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*FE2cWcPgacD-BFMoHvM55A.png" /></figure><p>เอาละเสร็จแล้ว เห็นไหม เราได้ Bot แล้ว แล้วนายก็จะได้ Token มา เก็บไว้ใช้ละ</p><p>อันนี้แหละ ที่ต้องเอาไปใช้ ที่นี้เราต้องได้ Chat_ID (รหัสช่องแชต) คลิกที่ Link Bot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*08dXNkxxichSz1xyeI2CUA.png" /></figure><p>จะได้หน้าจอ Chat มา ให้คลิกที่ Start</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*wKRhdoT1-F4uFSydEcwVyA.png" /></figure><p>พิมพ์ ข้อความลงช่อง Chat</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*7mS0gPlKlRAyuMm7mRhWsg.png" /></figure><p>เปิด Postman แล้ว Method เป็น GET แล้วใส่ URL : <a href="https://api.telegram.org/botYOUR_BOT_API_TOKEN/getUpdates">https://api.telegram.org/bot<strong>YOUR_BOT_API_TOKEN</strong>/getUpdates</a></p><p>ตรง <a href="https://api.telegram.org/botYOUR_BOT_API_TOKEN/getUpdates"><strong>YOUR_BOT_API_TOKEN</strong></a><strong> </strong>ใส่ Token ที่ได้มา อย่าลบคำว่า <strong>bot </strong>ละ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ISL3PCk6W1t-0K7DvR68MA.png" /></figure><p>เราจะได้ Chat_ID จากที่ Hilight</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*x4XtKZwUfD2d_01j4Bj-_g.png" /></figure><h3>**** ถ้าขึ้น Status 200 แต่ไม่มีอะไรขึ้น แสดงว่ายังไม่ได้พิมพ์ข้อความคุยกับ bot มาก่อน อย่าอ่านข้ามขั้นตอนนะครับ ***</h3><p>Method เป็น GET ส่วน URL เป็น <a href="https://api.telegram.org/bot$apiToken/sendMessage">https://api.telegram.org/bot</a><a href="https://api.telegram.org/botYOUR_BOT_API_TOKEN/getUpdates"><strong>YOUR_BOT_API_TOKEN</strong></a><a href="https://api.telegram.org/bot$apiToken/sendMessage">/sendMessage</a></p><p>ตรง <a href="https://api.telegram.org/botYOUR_BOT_API_TOKEN/getUpdates"><strong>YOUR_BOT_API_TOKEN</strong></a><strong> </strong>ใส่ Token ที่ได้มา อย่าลบคำว่า <strong>bot </strong>ละ</p><p>ในส่วน Body เลือก เป็น x-www-form-urlencoded</p><p>ตรง key ใส่</p><ol><li>chat_id</li><li>text เป็นข้อความที่ต้องการส่ง</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XX9I8wYU3tvLltByMqvXyA.png" /></figure><p>เมื่อกดปุ่ม send ก็จะได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*uyRWVEc2XzRfKalZneeyxw.png" /></figure><p>Update 7/3/2025</p><p>ไว้ติดตามตอนต่อไป</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61caa9f3818e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ทำ Zip File โดยการใส่ Password ด้วย Abbrevia (ฉบับ Github)]]></title>
            <link>https://farmonline.medium.com/%E0%B8%97%E0%B8%B3-zip-file-%E0%B9%82%E0%B8%94%E0%B8%A2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%AA%E0%B9%88-password-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-abbrevia-%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A-github-617761e1d90d?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/617761e1d90d</guid>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 09:17:56 GMT</pubDate>
            <atom:updated>2024-10-15T09:17:56.473Z</atom:updated>
            <content:encoded><![CDATA[<p>เมื่อ TZip ไฟล์ไม่เพียงพอต่อการนำเอาไปใช้เนื่องจาก ข้อมูลด้านใน sensitive มาก หรือ ใช้เพื่อเป็นการ lock สองขั้นตอน จึงมาแนะนำ Component Zip File ที่ผมเคยใช้ในสมัยก่อนแต่เมื่อก่อนบริษัทหยุดพัฒนาทำให้ไม่ได้ไปต่อ แต่ปัจจุบันมีการนำกลับมาพัฒนาต่อแล้วแจกจ่ายในรูปแบบ Opensource นั้นคือเจ้า Abbrevia นั่นเอง</p><p>เริ่มแรกก็คงต้องไป Download เจ้า Abbrevia มาซะก่อน</p><p><a href="https://github.com/TurboPack/Abbrevia">GitHub - TurboPack/Abbrevia: Abbrevia is a compression toolkit for Delphi and C++Builder.</a></p><p>นำ Path Source มาใส่ใน Library เช่น ผมเก็บไว้ใน D:\DevTools65\Abbrevia-master\Source</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*-94mRa8OfH6L2s91sYTQbw.png" /></figure><p>ทำการ Build แล้ว Install ให้เรียบร้อย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*jnJXZ3FAyrUKwmcBgixCNA.png" /></figure><p>เอาละมา code กัน</p><p>ตัวอย่างแรก คือการแตกไฟล์แบบปกติ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*x03mL7iO9jtJw-47jbeXww.png" /></figure><pre>procedure TForm1.Button2Click(Sender: TObject);<br>var<br>  zipFile :TZipFile;<br>  filename,Extractdir : String;<br>  AbUnZip : TAbUnZipper;<br>begin<br>  AbUnZip := TAbUnZipper.Create(nil);<br>  try<br>    AbUnZip.FileName := Edit1.Text;<br>    // Clean out old Directory and create a new one.<br>    Extractdir := Edit2.Text;<br><br>    CreateDir(ExtractDir);<br>    // Extract Files.<br>    AbUnZip.BaseDirectory := ExtractDir;<br>    AbUnZip.ExtractFiles(&#39;*.*&#39;);<br>    // Compare Extracted Files<br>  finally<br>    AbUnZip.Free;<br>  end;<br>end;</pre><p>ตัวอย่างสอง คือการแนบไฟล์แบบใส่ Password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*jduAH52x4IwwDNKKkC8zQw.png" /></figure><pre>procedure TForm1.Button4Click(Sender: TObject);<br>var<br>  zipFile :TZipFile;<br>  filename : String;<br>  Component : TAbZipper;<br>begin<br> zipFile := TZipFile.Create;<br>  try<br>    Component := TAbZipper.Create(nil);<br>    Component.BaseDirectory := &#39;D:\Zip\&#39;;<br>    Component.FileName := &#39;D:\Zip\AddZipDelphi.zip&#39;;<br>    Component.AddFiles(Edit3.Text,faAnyFile);<br>    Component.AddFiles(Edit4.Text,faAnyFile);<br>    Component.Password := &#39;IamGroot&#39; ;<br>    Component.StoreOptions := [];<br>    Component.Save;<br>    Component.CloseArchive;<br><br><br>  finally<br>    zipFile.Free;<br>    Component.Free;<br><br>  end;<br><br>end;</pre><p>ตัวอย่างสอง คือการแตกไฟล์แบบใส่ Password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*DbWwGXv79GGTGoRKIE3wZw.png" /></figure><pre>procedure TForm1.Button5Click(Sender: TObject);<br>var<br>  zipFile :TZipFile;<br>  filename,Extractdir : String;<br>  AbUnZip : TAbUnZipper;<br>begin<br>  AbUnZip := TAbUnZipper.Create(nil);<br>  try<br>    AbUnZip.FileName := Edit5.Text;<br>    // Clean out old Directory and create a new one.<br>    Extractdir := Edit6.Text;<br><br>    CreateDir(ExtractDir);<br>    // Extract Files.<br>    AbUnZip.BaseDirectory := ExtractDir;<br>    AbUnZip.Password := Edit7.Text  ;<br>    AbUnZip.ExtractFiles(&#39;*.*&#39;);<br>    // Compare Extracted Files<br>  finally<br>    AbUnZip.Free;<br>  end;<br>end;</pre><p>ดู code ได้ที่ Git hub <a href="https://github.com/piyanatn/Abbreviaexample">https://github.com/piyanatn/Abbreviaexample</a></p><p><a href="https://github.com/piyanatn/Abbreviaexample">GitHub - piyanatn/Abbreviaexample</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=617761e1d90d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Delphi Report Builder limit row per page]]></title>
            <link>https://farmonline.medium.com/delphi-report-builder-limit-row-per-page-1cf1c440be8e?source=rss-e3170bbc36b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cf1c440be8e</guid>
            <category><![CDATA[report]]></category>
            <category><![CDATA[limit-row-per-page]]></category>
            <category><![CDATA[reportbuilder]]></category>
            <category><![CDATA[delphi-programming]]></category>
            <dc:creator><![CDATA[Piyanat Nimkhuntod]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 14:30:56 GMT</pubDate>
            <atom:updated>2024-10-13T14:30:56.135Z</atom:updated>
            <content:encoded><![CDATA[<p>เมื่อออกแบบ Report แบบ Fix template มักจะมีปัญหาว่าโปรแกรมแสดงผลเกิน ช่องใน Template จึงขอแนะนำ วิธี Fix นั่นก็คือ ไปที่ Band Detail แล้วไปที่ Properties ที่ชื่อ PrintCount แล้วกำหนดจำนวนแถวได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lV6YxfJHxh81Lg8hc2-YgA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cf1c440be8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>