I have a list of string values representing the IPC id's submitted using SKILL.
eg: ipcList = ("ipc:15" "ipc:16" "ipc:20") etc,
I would like to query their status using ipcIsAliveProcess() and ipcReadProcess().
ipcStatus = ipcIsAliveProcess(nth(0 ipcList)),
but, I'm unable to do so as the datatypes do not match. Is there a way I can convert these "string" data values to "o_childId" type. Kindly guide me in solving this prolem.
Thanks in advance,
You can't. Why did you convert them to strings in the first place? ipc:N is just the print representation of an IPC ID, it's not the ID itself. The IPC ID is a specific object type, and as far as I know there's no API (public or private) to convert from a number or string into the corresponding IPC ID.
If you store them as their original object types - even as a list of them - then you can use them directly
listOfIpcIds=nilfor(i 1 10 listOfIpcIds=cons(ipcBeginProcess("sleep 100") listOfIpcIds))
then you can do
statuses=foreach(mapcar ipcId listOfIpcIds ipcIsAliveProcess(ipcId))
In reply to Andrew Beckett:
Thank you for your quick reply.
The code is a part of much larger, GUI based script. It actually submits and moitors the various jobs given by the user. I am basically storing the jobs and their corresponding ipcIds as choices inside a report field "hiCreateReportField" as passing values becomes easy and I can minimise my "variables" count (in my opinion), but report field takes in only string, float and int as values. Hence the string list.
My typical Report Field display in my GUI,
Sl.No Cell Name Job Name Job Status
1 NandGate DRC Running
2 NorGate LVS Complete
3 Inverter DRC Running
And, If I cannot convert the string to other dataTypes, then I
guess I will have to maintain a separate list variable to work on and
then pass it to the GUI report field as choices.
Thank a lot :)
In reply to Aditya A S V:
You can avoid having to have a global variable for this by storing the mapping as a property on the field or the form. For example:
You can add whatever user-defined properties on the form or field objects as you wish. This could be a simple hash table (e.g. association table produced using makeTable()).
Thank you for you inpus, but I am not really sure how to implement the suggestion you have put forward. Could you kindly provide me with some more insight, perhaps a snippet code might do the trick.
At some point in your code you have the original ipc ids before you convert them to strings for your report field. So let's say you have the following:
ipcIds = list(of some ipc ids)ipcTable = makeTable("ipcIds" nil)foreach(ipcId ipcIds sprintf(ipcString "%L" ipcId) ipcTable[ipcString] = ipcId)
Then you can store this either on your form or your report field:form->ipcTable = ipcTableorform->reportField->ipcTable = ipcTable
When your Skill code that reads the currently selected item in the report field needs to know the original ipcId, you can get it from the table. First, get the ipcString from the appropriate column of the selected item in the report field, then use this:
ipcId = form->ipcTable[ipcString]
This is a great way to store data without having to create a lot of global variables.
I hope this helps.
In reply to dmay:
Thanks Derek - the day job has been preventing me from giving much more than 1 line answers during the last couple of days!