i tried to set element.args().parmObject() to pass it to batch class but i always get an error mentioning An object reference not set to an instance of object.
Please help.
i tried to set element.args().parmObject() to pass it to batch class but i always get an error mentioning An object reference not set to an instance of object.
Please help.
Yes, I know you would, but I explicitly told you that it's impossible, explained why and described a way how you can achieve your goal, including giving you code. What else can I do?
All right, let me repeat it once more. You can't pass objects to batch. You must serialize objects to primitive data types, store them in a container and this container can be saved to database for batch processing. A usual way to serialize objects to a container is using pack() method. This is true for both RunBase classes and SysRecordSortedList class. I told you before that SysRecordSortedList the benefit of SysRecordSortedList is that it supports packing.
The code I gave you shows calling pack() on SysRecordSortedList object to get a container for the list and then adding it to your RunBase class (its pack() method is then called by the framework).
Let me suggest for the third time that you should open the links about packing that I gave you and read the content. Things would make better sense to you if you learnt a bit about them.
i would like to know how to pass this type of object inside the container as the method i call has recordSortedList in its arguments so please advise.
If it's not obvious that container and RecordSortedList are two different types, you can try it and you'll see whether the compiler complains about assigning values of wrong types.
When you finish this exercise, remove the change you made in my code, which broke the whole thing.
Thanks a lot,Martin for clarification but i have one more thing to ask about. the object i need to pass from form to batch is of type RecordSortedList so is it possible to call mybatch.parmPackedList(_args.parmObject()) or it will throw an error?
Please make sure you give us your actual code. Looking at different code than you're using makes little sense.
What I told you apply to all objects, including SysRecordSortedList - you can't put them into containers and let them stored in batch tables. But as I told you before SysRecordSortedList has a pack() method that you can call to get the list serialized to a container. Therefore you can use a container as your instance variable:
class FixedAssetsBatch extends RunBaseBatch { container packedList; DimensionDefault defaultDimension; #define.CurrentVersion(1) #define.Version1(1) #localmacro.CurrentList defaultDimension,packedList #endmacro public container pack() { return [#CurrentVersion,#CurrentList]; } public container parmPackedList(container _packedList = packedList) { packedList = _packedList; return packedList; } }
and call pack() method on the list before assigning it to the container:
myBatch.parmPackedList(sortedList.pack());
Martin means to use the "Use rich Formatting" when posting to this forum to insert code, it makes it more readable. Copying and pasting directly without using insert will make the code messy and hard to read.
Regards
Sorry, i mean SysRecordSortedList
but i need to know how to call insert and what method i should use insert.
What is SysSortedList? I guess it's a collection class and you can't assign object references to the container. Even it it didn't throw an error, it would make no sense. Object references are addresses in memory and they don't have the same meaning on other computers. Don't you want to read again the resource I gave you about packing?
By the way, you again forgot to use Insert > Insert Code when pasting source code. Please do it in future.
Here is my code below:
class FixedAssetsBatch extends RunBaseBatch
{
AssetTransferBalancing assetTransfer;
SysSortedList assetBookList;
DimensionDefault defaultDimension;
#define.CurrentVersion(1)
#define.Version1(1)
#localmacro.CurrentList
defaultDimension,assetBookList
#endmacro
public container pack()
{
return [#CurrentVersion,#CurrentList]; ///Error hits in this line
}
}
Is there any chance to see your code? Which line throws the error?
André Arnaud de Cal...
294,261
Super User 2025 Season 1
Martin Dráb
233,013
Most Valuable Professional
nmaenpaa
101,158
Moderator