This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

M-Files Configuration Frequency Interval

I am working on setting up something in my configuration that includes a RecurringOperationConfiguration

I have it working for schedule without any issue but when I try and lookup Interval it seems a bit vague and I don't really understand what the Time Value in the configuration is for.

It says it is configurable but I don't quite understand how to control the interval from the admin if it's giving me a Time Value. I've ready the following and haven't clued in on what I should be doing to allow the admin to decide what the interval should be/

https://developer.m-files.com/Frameworks/Vault-Application-Framework/Task-Queues/Recurring-Tasks/

What do I need to do for the admin to be able to set something like run every 2 hours?

Parents
  • Hi,

    The editor seems to render differently depending on...  Something.  Possibly your local PC settings.  In a lot of systems it renders as a 24-hour clock (which then makes more sense as an interval), but when it renders as an AM/PM time it's awkward.

    In your instance "every two hours" would be "2am".  Every 14 hours would be "2pm".  As I said: awkward.

    This hasn't come up as a significant issue thus far, but I will raise it with the VAF/configuration-editor team at some point to see whether there's a way we can force it to always be in 24-hour mode.

    Regards,

    Craig.

  • That is what we figured but additionally you cannot enter a 0 for the first hour so you cannot set an interval less than 1 hour with this issue.

Reply Children
  • If you place the cursor in the hour section and type "00", does it not move you to the minute section?

  • No, in fact the 0 key does affect the hours at all. Only 1-9 have any affect.

  • I can't replicate this here (I see "00:00:00"), but I know a man who may be able to.  I will hopefully be able to test this tomorrow.

  • Craig asked me to test this, as he does not see the AM/PM issue in his environment.

    It looks like you indeed cannot set "00" in the hour part. I cannot figure out the exact logic, but it looks like it turns it back to the previous "valid" input there was before as the hour. 

    You can change the hour to 00 behind the advanced tab in JSON, then e.g. "00:00:00" will show up as "12:00:00 AM" in the editor. Which, I guess, somehow weirdly makes sense, as "00:00:00" would be midnight :)

  • One more thing: trying to set the interval to something big like "24:00:00" in JSON produces an "unsupported value" error on the editor side.

  • Hi,

    I have also had hard times by setting this up. Like Petri mentioned, the interval is actually the same as how long has past from midnight. So basically 5min interval should be set with 24h clock "00:05:00" and with 12h clock: "12:05:00 AM".

  • Of course!

    I have also reached out internally to see whether there's a way we could do this better.

  • So I am having an issue with this in general, maybe I am doing something wrong but interval only runs once and then never runs again. My interval settings are:

     (every 3 minutes)

    Which shows that it will run every 3 minutes, but also says stopped in the top right:

    Ignore the error, that was just me testing something else.

    Ultimately I am using a TaskProcessor to do something every x minutes.

    [TaskProcessor(QueueId, POTimeLoopApp1)]
    public void POTimeLoop1(ITaskProcessingJob<TaskDirective> job)

    Is there something else I should be doing here? A better way to do this? After the first run it just switches to Stopped and never runs again. 

  • It should only show stopped if the task never gets scheduled for the future. As the interval itself is being read properly it makes me wonder whether something is interfering with the reschedule.

    Any errors in the processing, overriding any methods on the vault application?

    Could you share the application with me to take a look at? 

  • I cannot share the entire application but here is the code for the task, I know it's not the best and I am more focused on getting the functionality working but I feel like I am missing something? Everything works properly when on a schedule, just not an interval:

    I've Updated my code to make use of transactionalVault and not my old login method:

    [TaskProcessor(QueueId, POTimeLoopApp2)]
            public void POTimeLoop2(ITaskProcessingJob<TaskDirective> job)
            {
                //try
                //{
    
                //this sends a message to the dashboard saying the operation is complete
                job.Commit((transactionalVault) =>
                {
                    string today = System.DateTime.Now.ToString("dddd");
                    if ((today == "Saturday" || today == "Sunday" || today == "Samedi" || today == "Dimanche") && this.Configuration.POTimeLoop.POTimeLoop2Settings.SkipWeekends == false)
                    {
                        //get IDs for configurations to check if they have been entered
                        int classID = this.Configuration?.POTimeLoop?.POTimeLoop2Settings?.ClassToRunOn?.ID ?? -1;
                        int startStateID = this.Configuration?.POTimeLoop?.POTimeLoop2Settings?.StartWorkflowAndState?.State?.ID ?? -1;
                        int endStateID = this.Configuration?.POTimeLoop?.POTimeLoop2Settings?.StartWorkflowAndState?.State?.ID ?? -1;
                        int incrementProperty = this.Configuration?.POTimeLoop?.POTimeLoop2Settings?.IncrementPropertyInteger?.ID ?? -1;
    
                        //Vault Vault;
    
                        //if the authentication, class, start and end state, and is enabled then proceed
                        if (this.Configuration.POTimeLoop.POTimeLoop2Settings.Enabled == true
                    && classID > -1
                    && startStateID > -1
                    && endStateID > -1
                    && this.Configuration.POTimeLoop.POTimeLoop2Settings.LocalVaultGUID != null
                    && this.Configuration.POTimeLoop.POTimeLoop2Settings.AuthenticationType != null
                    && this.Configuration.POTimeLoop.POTimeLoop2Settings.Login != null
                    && this.Configuration.POTimeLoop.POTimeLoop2Settings.Password != null)
                        {
                            ////create connection and connect to the vault, if the authentication type is MFiles user, login accordingly
                            //if (this.Configuration.POTimeLoop.POTimeLoop2Settings.AuthenticationType == "2")
                            //{
                            //    MFilesServerApplication oApp = new MFilesServerApplication();
                            //    oApp.Connect(MFAuthType.MFAuthTypeSpecificMFilesUser, this.Configuration.POTimeLoop.POTimeLoop2Settings.Login, this.Configuration.POTimeLoop.POTimeLoop2Settings.Password, "", "ncacn_ip_tcp",
                            //        "localhost", "2266", "", false);
                            //    Vault = oApp.LogInToVault(this.Configuration.POTimeLoop.POTimeLoop2Settings.LocalVaultGUID);
                            //}
                            ////if not mfiles user authentication then login using specific windows user
                            //else
                            //{
                            //    MFilesServerApplication oApp = new MFilesServerApplication();
                            //    oApp.Connect(MFAuthType.MFAuthTypeSpecificWindowsUser, this.Configuration.POTimeLoop.POTimeLoop2Settings.Login, this.Configuration.POTimeLoop.POTimeLoop2Settings.Password, "", "ncacn_ip_tcp",
                            //        "localhost", "2266", "", false);
                            //    Vault = oApp.LogInToVault(this.Configuration.POTimeLoop.POTimeLoop2Settings.LocalVaultGUID);
                            //}
    
                            //if logged in
                            //if (Vault.LoggedIn == true)
                            //{
                            //search for all the objects in that class and in that state
                            MFSearchBuilder poTimeLoopSearch = new MFSearchBuilder(transactionalVault);
    
                            //if deleted and loop through the classes
                            poTimeLoopSearch.Deleted(false);
                            poTimeLoopSearch.Class(this.Configuration.POTimeLoop.POTimeLoop2Settings.ClassToRunOn.ID);
                            poTimeLoopSearch.Property(39, MFDataType.MFDatatypeLookup, this.Configuration.POTimeLoop.POTimeLoop2Settings.StartWorkflowAndState.State.ID);
    
                            var results = poTimeLoopSearch.Find();
    
                            //loop through the results
                            if (results.Count > 0)
                            {
                                for (int i = 1; i <= results.Count; i++)
                                {
                                    ObjVerEx objectToLoop = new ObjVerEx(transactionalVault, results[i].ObjVer);
    
                                    //if the increment is not empty, increase it by 1 and change the state
                                    if (objectToLoop.GetProperty(this.Configuration.POTimeLoop.POTimeLoop2Settings.IncrementPropertyInteger.ID).TypedValue.DisplayValue != "")
                                    {
                                        PropertyValues properties = new PropertyValues();
    
                                        properties.Add(-1, newObject.createPropertyValueLookup(39, this.Configuration.POTimeLoop.POTimeLoop2Settings.EndWorkflowAndState.State.ID));
    
                                        int incrementValue = Int32.Parse(objectToLoop.GetProperty(this.Configuration.POTimeLoop.POTimeLoop2Settings.IncrementPropertyInteger.ID).TypedValue.DisplayValue);
                                        incrementValue++;
                                        properties.Add(-1, newObject.createPropertyValueInt(this.Configuration.POTimeLoop.POTimeLoop2Settings.IncrementPropertyInteger.ID, incrementValue));
                                        objectToLoop.SaveProperties(properties);
                                    }
                                    //if the increment is empty set it to 0 and change the state
                                    else
                                    {
                                        PropertyValues properties = new PropertyValues();
    
                                        properties.Add(-1, newObject.createPropertyValueLookup(39, this.Configuration.POTimeLoop.POTimeLoop2Settings.EndWorkflowAndState.State.ID));
    
                                        properties.Add(-1, newObject.createPropertyValueInt(this.Configuration.POTimeLoop.POTimeLoop2Settings.IncrementPropertyInteger.ID, 1));
                                        objectToLoop.SaveProperties(properties);
                                    }
                                }
                            }
                        }
                    }
                });