I have a standard lookup table database table "LOOKUP_TABLE_VALUES" in a SharePoint 2013 solution with columns like:
- LT_UID - for the Lookup table GUID
- LT_VALUE_FULL - storing the values with the lookup table levels (delimited with '.')
- LT_VALUE_SORT_INDEX - assigning index to each value from the above column, such as '1', '2' and so on.
For some reason the values in the LT_VALUE_SORT_INDEX column are not correct and I want to change them. But I cannot use MSSQL and execute a query against that column. The only option is to do it via PSI - either with a PowerShell script, or some Visual Studio Solution.
Ideally, I would have a query something like this:
SELECT [LT_UID],[LCID],[LT_VALUE_SORT_INDEX],[LT_VALUE_FULL] FROM [xxx].[xxx].[MSP_LOOKUP_TABLE_VALUES] WHERE LT_UID = 'GUID HERE' ORDER BY LT_VALUE_FULL
So the values in the LT_VALUE_SORT_INDEX have to be incremented (starting from 1) for each row returned by LT_VALUE_FULL in that order (ascending).
I am a newbie with PowerShell and I cannot come up myself with a solution. At the same time, I cannot find out how to use the PSI to fetch the values and update the lookup table for the sorted index column.
Any help is appreciated! i.e. links to resources, ideas, partial solutions, etc.