Jump to content


  • Posts

  • Joined

  • Last visited

FileMaker Experience

  • Skill Level
  • FM Application
    16 Client

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

root_iv's Achievements


Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges



  1. big hack#1 "JSON and FileMaker 16" https://t.me/filemaker_help January 25, 2018 In development process of information system definite records are required to be selected. For example, needed nomenclature could be added to shopping basket from product list. With 16 system release and adding functions JSON implementation of this task was greatly simplified. Earlier for user selects holding global field or supporting table was required. We had to follow that this field or table were emptied before every new selection procedure. Only public variable is needed now. All information about selected records can be easily added and read by using function JSON,, where the result will be the following JSON- text: “{"1":true,"3":true,"4":true}” in which 1,3 and 4 – keys , which name corresponds to chosen identifier (if we chose record with id 1,3 and 4). Every key gets assigned the same boolean value: true. Script , applying data-hold in JSON-text, is simply arranged . Let us suppose, we handle button, by which the user choses certain record or unselects. Thus we decided to store JSON-text in public variable $$JSON. STEP1 From the beginning we need to initialize JSON-text as it is not empty in initial state, it looks as : “{}”. We can do it once in the script, prenex user’s work with recordset. At this script item will appear : Set Variable [$$JSON; “{}”]. But we can dispence with preliminary script. For example, we can perform such check each time, user push the botton to “select” record. The check will look so: If (IsEmpty ($$JSON);"{}";$$JSON) Later identifier value of current record can be accounted and memorized in variable $id_record. Set Variable [$id_record; GetLayoutObjectAttribute ("id";"content")] In order to item in script worked with using function GetLayoutObjectAttribute, It is needed to place object on layout, displayed ID item, and name “id”. STEP2 Then you make sure existence of tandem in JSON-text, whose name of key corresponds to identifier. If current record has identifier 5, we have to find tandem “5”:true. Here we use function JSONGetElement JSONGetElement($$JSON; $id_record) STEP3 As such tandem doesn’t take place in our example, function returns “empty”. It means this tandem needs to be added to JSON-text by function JSONSetElement JSONSetElement ($$JSON; $id_record), результатом будет запись в $$JSON: “{"1":true,"3":true,"4":true, "5":true}” If JSONGetElement($$JSON; $id_record) returns 1, it means that in text record is already considered. We need to do back action,- delete tandem from JSON by function JSONDeleteElement JSONDeleteElement($$JSON; $id_record), if $id_record was equal to 3, so tandem "3":true," would be deleted and we would get: “{"1":true,"3":true,"4":true}” Thus , efforts are being made to fix and regulate chosen item in case of using JSON-function – minimum. Let us draw our conclusion. For implementation of this task we need: To create JSON-text in public variable $$JSON To check using function JSONGetElement, if value from $id_record took place in $$JSON. If it there isn’t , needed value from $id_record should be added in $$JSON using JSONSetElement If record should be deleted from $$JSON, we use JSONDeleteElement. Script "CheckButton" from MS.fmp12 #Write the current value of the object named id Set Variable [ $record_id; Value:GetLayoutObjectAttribute ( "id";"content" ) ] #check if there is a JSON variable Set Variable [ $$MULTISELECT_LIST; Value:If (IsEmpty ($$MULTISELECT_LIST);"{}"; $$MULTISELECT_LIST ) ] #switch if the variable is empty then write, otherwise delete If [ JSONGetElement ( $$MULTISELECT_LIST;$record_id)] Set Variable [ $$MULTISELECT_LIST; Value: JSONDeleteElement ( $$MULTISELECT_LIST;$record_id )] Else Set Variable [ $$MULTISELECT_LIST; Value: JSONSetElement ( $$MULTISELECT_LIST;$record_id; 1; JSONBoolean) ] End If #refresh checkboxes Refresh Window Refresh Object [ Object Name: "checkbox" ] Download file MS.fmp12 Invest in the development of our project We are ready to help in your development projects. Contact us and we will try to help you: artidog@gmail.com MS.fmp12
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.