Home > Forum > Processes > Converting fields from different processes to global fields

Converting fields from different processes to global fields
0

Hi all!

We have different processes with a common fieldset, e.g. customer number, valid from, valid to and so on

All these fields have been added to these different processes without using global fields, but atually have the same meaning, which makes reporting and SQL queries over these different processes somehow difficult.

Is it possible to convert these fields to global fields, regarding the aspect that we already have several thousand instances in the customer system?

Thanks a lot in advance & best regards, Nik

MVP

Hi Nik,

even so I always argue against it, I didn't come up with a better way than doing this on database level and each environment.

We used the below script for this. I added the line with "is not null" in this post, so I didn't test it and maybe there's a syntax error.

Why did I add it:
We switched to the global field in our dev environment and created some instances and then tested the script. It worked fine for all old instances, but the new instances lost their value. After all the null value from Text1 replaced the current value.

So you may keep this in mind.

The best way would be to transfer the field values just before the process is imported.

Best regards,
Daniel

-- update Form Type xyz
Update WFElements
set WFD_AttText1Glob = WFD_AttText1
where WFD_DTYPEID
in (
select DTYPE_ID
from WFDocTypes
where DTYPE_Guid in ('129e5a2b-5c44-42d8-99b6-6588d8ff0cf4')
and WFD_AttText1 is not null
)

Update WFHistoryElements
set WFH_AttText1Glob = WFH_AttText1
where WFH_DTYPEID
in (
select DTYPE_ID
from WFDocTypes
where DTYPE_Guid in ('129e5a2b-5c44-42d8-99b6-6588d8ff0cf4')
and WFH_AttText1 is not null
)

In reply to: Daniel Krüger (Cosmo Consult)

Hi Nik,

even so I always argue against it, I didn't come up with a better way than doing this on database level and each environment.

We used the below script for this. I added the line with "is not null" in this post, so I didn't test it and maybe there's a syntax error.

Why did I add it:
We switched to the global field in our dev environment and created some instances and then tested the script. It worked fine for all old instances, but the new instances lost their value. After all the null value from Text1 replaced the current value.

So you may keep this in mind.

The best way would be to transfer the field values just before the process is imported.

Best regards,
Daniel

-- update Form Type xyz
Update WFElements
set WFD_AttText1Glob = WFD_AttText1
where WFD_DTYPEID
in (
select DTYPE_ID
from WFDocTypes
where DTYPE_Guid in ('129e5a2b-5c44-42d8-99b6-6588d8ff0cf4')
and WFD_AttText1 is not null
)

Update WFHistoryElements
set WFH_AttText1Glob = WFH_AttText1
where WFH_DTYPEID
in (
select DTYPE_ID
from WFDocTypes
where DTYPE_Guid in ('129e5a2b-5c44-42d8-99b6-6588d8ff0cf4')
and WFH_AttText1 is not null
)

Hi Daniel!

As always thanks for your great answer.

Yes I agree, that these update statements have to be executed directly after deploying new global fields, so the NULL check would be unnecessary.

Nevertheless, a NULL check is a good idea (for safety reasons).

The only problem I have is that our system is SaaS, where direct DB access is not possible and also SQL queries are restricted within Webcon.

I have to figure it out, already created a support ticket for that.

Thanks a lot & best regards, Nik