No announcement yet.

Setting values beforeinsert

  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting values beforeinsert

    Before a record is inserted I need to do a couple of things to the record.
    1. I need to create a GUID for the unique key. How do you generate a GUID in scriptcase? Help and forum search for GUID turns up nothing.

    2. I need to set another field to a value that has been selected on a master form (application link) Can I use a macro to get a value on another form? Or do I have to set a global variable somehow? Maybe when a user clicks on a field, a global variable gets set? Is that possible?
    Last edited by leroy_hack; 09-13-2015, 11:44 AM.

  • #2
    Why would you need a GUID? If you need one, know GUID is a microsoft thing.
    If you want to create a guid you can go to: and find the info there.
    Since you can call an exe in php (or even run a vb script) you should be able to get a guid.
    If you are on windows you can use:

    A little bit of googling will help a lot...

    If you use an application link you can simply call the other application with a variable in it or you can set a global variable.

    Setting a global variable is stupidly simple [global_var1]='I am a global variable with some value';
    I suggest checking the basics of scriptcase, this is one of the basics.


    • #3
      No, a guid is just a unique identifier. This is one of the options:

      function guid(){
          if (function_exists('com_create_guid')){
              return com_create_guid();
              mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
              $charid = strtoupper(md5(uniqid(rand(), true)));
              $hyphen = chr(45);// "-"
              $uuid = chr(123)// "{"
                      .substr($charid, 0, 8).$hyphen
                      .substr($charid, 8, 4).$hyphen
                      .substr($charid,12, 4).$hyphen
                      .substr($charid,16, 4).$hyphen
                      .chr(125);// "}"
              return $uuid;
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development /