How to perform Sort (not using Asc or Desc)

Hello! Can anyone help me how to sort the values below to this order?

Open → Signed off by Appraisor → Signed off by HLM → Completed → Waived

image

Hi,

How about the following?

Sequence.xaml (5.9 KB)

Regards,

How will I integrate it in my build?

image

image

Hi,

Can you try the following with Assign activty? (Let’s say dt as your datatable)

dt = dt.AsEnumerable.OrderBy(Function(r) Array.IndexOf(masterArray,r("targetColumn").ToString)).CopyToDataTable

Regards,

I’ve declared the masterArray and the dt data table. But where will I put the dt? Sorry, I’m having a hard time picturing it out.

image

image

Hi,

The dt is already sorted (by the above expression). We don’t need to use Sort DataTable activity.

IF your datatable is CFRCastilio, the expression will be the following.

CFRCastilio= CFRCastilio.AsEnumerable.OrderBy(Function(r) Array.IndexOf(masterArray,r("targetColumn").ToString)).CopyToDataTable

Regards,

Oh I see, let me give it a try.

Hi @Yoichi,

It worked. But after using it again, it returned

image

Here’s my build

image

Hi,

Probably your datatable has no data. You need to check whether the datatable has row(s) using if activity like CFRArellano.Rows.Count>0, then execute this expression

Regards,

I put it in a message box and it return a False, which means my main datatable has no data right?

What could I possibly do with this coz I have like 10 more data table that would need to look up on my main datatable?

Hi,

Yes. you are right.

What could I possibly do with this coz I have like 10 more data table that would need to look up on my main datatable?

I suppose there isn’t enough information to solve this matter. Can you share more detail information such as workflow file?
It might be better to raise another topic because of shifting this topic.

Regards,

I’ll send a sample workflow.

Main.xaml (15.0 KB)

Here it is

Hi,

Hope the following helps you. In this case, we can use for each loop.

Main(4).xaml (15.6 KB)

Regards,

@Yoichi

That’s the approach I’ve wanted but we have some problem on the Filter activity. The way I filter per person is different from the other that’s why I hard coded each person and create Filter activity for each of them. Unless we can modify some of the filter for other person, we can use the code you have provided.

Hi,

If it’s difficult to reduce to single filter datatable activity, can you try to put Switch activity and put each filter datatable in each case?

Regards,

Can you give sample xaml on that? I’m trying to use Switch Activity but I’m having an error.

Hi,

Here you are.

Main(4).xaml (16.7 KB)

Regards,

Hi Yoichi,

Tried revising the xaml file you have sent. It produced all the reports I needed but the first Case was the only one that has data on it :frowning: the remaining were blanked.

Hi,

Can you check your filter condition?

and/or

Can you set Breakpoint at 2nd or later filter datatable activity, then run debug mode?
Workflow will stop there, and check content of input datatable.
Next press f11 (step into) then execute filtering. check content of output datatable.

Regards,