Invalid Dataset Error During Function API Call

Add using Newtonsoft.Json.Linq; to the usings section.

Complete example is in the libraries.

1 Like

That did the trick! Thanks again, this was a huge help. I had a suspicion that even though the signature for the TransformAndSubmit object shows “ds” it wasn’t liking it, just didn’t know what it did want. It now seems to be satisfied!

2 Likes

@Olga any clue why they did this? (method takes JToken/JObject instead of DataSet)

Seems kind of odd.

1 Like

i think this is it

1 Like

Yeah, just wondering why they just didn’t take a DataSet.

I mean, they did… lol, but why not a strongly typed one, instead of a representation of one.

Parameter is not even dataset, it is object

public void TransformAndSubmit(object ds, string agentID, long agentSchedNum, int agentTaskNum,
			string maintProgram)
		{
            var dsJObject = ds as JObject;

The code is specific for browser UI, so they don’t know what dataset it, they work with Json :woman_shrugging:

Yes, that’s what I’m saying.

You are passing it a dataset, so it takes a dataset in reality, but what the method wants is like a JToken / JObject.

I’m wondering why they did that.

Missed this part. :rofl:

You’d figure they’d worked with enough of them by now in the rest of the code to keep it consistent.

They created method that is easier to process from browser for them.

Yeah they did that before, I don’t think it’s good practice, but whatever. :poop:

1 Like