Dynamically Returning an Image URL as Context Data
For fluid activity guides only, you can define a method to use defined context data to dynamically return an image URL as additional context data.
In the following example, the EMPLID is defined as context data, which is used to dynamically generate the image URL to the employee’s photo:
import PTAI_ACTION_ITEMS:*;
import PTAI_ACTION_ITEMS:AGInterface;
import PTAI_COLLECTION:Collection:*;
...
class AG implements PTAI_ACTION_ITEMS:AGInterface
method getEmployePhoto(&oCtxt As PTAI_COLLECTION:Collection) Returns string;
...
end-class;
method getEmployePhoto
/+ &oCtxt as PTAI_COLLECTION:Collection +/
/+ Returns String +/
Local integer &i = 1;
While &i <= &oCtxt.Count
If ((&oCtxt.Item(&i) As PTAI_ACTION_ITEMS:ContextData).fieldname = "EMPLID") Then
Local Rowset &rs = CreateRowset(Record.EMPL_PHOTO);
Local string &strEmplID = (&oCtxt.Item(&i) As PTAI_ACTION_ITEMS:ContextData).keyValue;
&rs.Fill("where EMPLID =:1", &strEmplID);
Return %Response.GetImageURL(&rs.GetRow(1).GetRecord(Record.EMPL_PHOTO));
End-If;
&i = &i + 1;
End-While;
end-method;