Matlab production server and tibco spotfire data marshalling.

2 views (last 30 days)
How can I marshall date time data column from TIBCO Spotfire to Matlab production server?
When I try to send datetime from spotfire to mps I have 2 kind of errors :
  • If data format is date time error on mps side.
  • If data format is string, no error from mps but Spotfire :
could not execute function call 'MyFunction' (2)
Message missing required fields: lhs[0].type

Answers (1)

Hari
Hari on 10 Jan 2024
Hi Miguel Marmori,
I understand that you are trying to order datetime data from TIBCO Spotfire to MATLAB Production Server (MPS) and are encountering errors. When sending datetime-formatted data, you receive an error on the MPS side, and when sending string-formatted data, you encounter an error in Spotfire related to missing required fields.
To resolve the marshalling of datetime data, you should ensure that the data is serialized into a format that MPS can understand. MPS expects data to be in a format that can be deserialized into MATLAB types. For datetime, this often means converting to a string representation that MATLAB can interpret and then converting back to datetime within MATLAB.
Here's a general approach:
  1. Convert the datetime data to a string format in Spotfire using a supported format string that MATLAB can interpret, such as ISO 8601 (`'yyyy-MM-ddTHH:mm:ss'`).
  2. Send this string to MPS.
  3. In your MATLAB function that is deployed on MPS, convert the string back to a datetime using `datetime` function with the appropriate format.
Example MATLAB function code snippet:
function result = MyFunction(datetimeString)
% Convert string to datetime
datetimeValue = datetime(datetimeString, 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss');
% Your code here to process datetimeValue
% Prepare the result
result = ...; % some result based on your processing
end
Refer to the documentation of MATLAB Production Server for more information on data marshalling and type conversion:
For details on how to work with datetime in MATLAB and perform conversions, refer the MATLAB documentation for the "datetime" function:
Hope this helps!

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!