AnsweredAssumed Answered

Reset field contents based on newer file

Question asked by lowergroovemusic on May 17, 2017
Latest reply on May 17, 2017 by lowergroovemusic



I am new to FM Pro, watching You Tube videos etc, but am getting confused re. scripting etc and was hoping someone could help with something that I am going in circles with. All help very much appreciated.


For background. I have two tables -  one called Tracks the other called Audio. Within a Tracks layout I have a portal that shows the Audio table based on a Track ID (Primary key: Tracks) to Track ID (Foreign key: Audio). Therefore, a track can have many audio files associated with it.


One of the Audio table fields is called Latest Version, the contents of which are driven by a value list with the options Yes/No. For each track, only one of the related, audio file, Latest Version fields should be set to "Yes". Please also note that the audio file I might want to upload at any time may not be the most-up-to date version of the track - but a legacy copy that I wish to store.


The following is the envisaged User Experience I am battling with...


  • From the layout, showing the portal, I click on a button - within a portal record - to upload a new audio file;
  • This results in a pop up window which asks me if this is the most recent version of the track;
  • If I select "No" then the Latest Version field is set to no and the track upload proceeds and returns to the original portal view - that displays the new record;
  • If I select "Yes" then the script checks to ensure no other Latest Version fields are set to "Yes". If not the upload continues and returns to the original portal view - that displays the new record;




If I select "Yes", and the script checks and there is already a Latest Version field set to "Yes", I want a dialogue box message to appear that informs me of such, i.e. "A track is already set as being the latest version", and gives me the option to view the older record within the portal view or over ride the fact it is set to "Yes" and make my new upload the latest version - both achievable by clicking buttons. Therefore -


1). Choose over-ride - if I select the over ride option I would like the script to change the older Latest Version field content from "Yes" to "No" and create a new record, for the new file where the Latest Version filed content is set to "Yes".




2). Choose view - if I select view I would somehow like to view the older record and it's metadata - created date etc and filename - to ensure I wasn't uploading a duplicate audio file. If not then the next action would be as 1). above.


I hope this makes sense and is not too much of an ask. Again, all help appreciate.


Thanks in advance.