LaRetta Posted February 7, 2015 Posted February 7, 2015 (edited) I am in need of a temporary bandaid during a migration while we consider changing a process. I want a calculation that takes a list of fields (which are containers holding icons) and puts them into a single global container calculation repetition so I can use rep1 for 'Add' and rep2 for 'Edit' etc. globally. I've used similar with regular Admin and Preferences data but not like this. Upon startup, icon_TRIGGER (a global number in the one-record Admin table) will be set with 1. This script step can also trigger this calculation to re-evaluate. The refresh will fill the global containers at startup for use during the User session. It is temporary ... I know it can break if I change the order ... all I need is quick fix. If I can make this calc work, the 'fix' will only require a single calculation and the fewer moving pieces, the easier it will be when removing it again. Here is my attempt which failed (quite miserably). I believe that containers can't be treated like text multi-lines and it has other issues as well, such as no extend (what would I extend?) Let ( [ trigger = Admin::icon_TRIGGER ; i = Get ( CalculationRepetitionNumber ) ; icons = List ( Admin::icon_add ; Admin::icon_delete ; Admin::icon_edit ; Admin::icon_gotoDetail ; Admin::icon_popover ; ) ; icon = GetField ( GetValue ( icons ; i ) & "[" & i & "]" ) ] ; Case ( i ≤ ValueCount ( icon ) ; GetValue ( icon ; i ) ) ) I also realize I could reverse it - put the icons into repetitions - that would be easiest but there are many companies on versions of these files and I can't make that kind of drastic change just yet. Any ideas while I still have some roundness to my forehead? And if I HAVE to add more schema just for this functionality I suppose I will but I don't want to mirror all those fields nor create another table (yet). added sentence in blue Edited February 7, 2015 by LaRetta
eos Posted February 7, 2015 Posted February 7, 2015 Try: Let ( [ trigger = Admin::icon_TRIGGER ; i = Get ( CalculationRepetitionNumber ) ; iconList = List ( GetFieldName ( Extend ( Admin::icon_add ) ) ; GetFieldName ( Extend ( Admin::icon_delete ) ) ; GetFieldName ( Extend ( Admin::icon_edit ) ) ; GetFieldName ( Extend ( Admin::icon_gotoDetail ) ) ; GetFieldName ( Extend ( Admin::icon_popover ) ) ) ] ; Case ( i ≤ ValueCount ( iconList ) ; Extend ( GetField ( GetValue ( iconList ; i ) ) ) ) ) 1
comment Posted February 7, 2015 Posted February 7, 2015 Although: Extend ( GetField ( ... ) ) works after a fashion, I would suggest you avoid the detour and get directly to what you want, for example: Let ( trigger = Extend ( gTrigger ) ; Choose ( Get ( CalculationRepetitionNumber ) - 1 ; Extend ( Icon_add ) ; Extend ( Icon_delete ) ; Extend ( Icon_edit ) ) ) Note the Extend() around the triggering field - I don't think it will work without it, even in your version. -- P.S. This is a calculation field in the Admin table, is it not? Why does it need fully qualified field names to reference fields in the same table? 1
LaRetta Posted February 7, 2015 Author Posted February 7, 2015 Wow, thanks guys, I see now where I got twisted. -- P.S. This is a calculation field in the Admin table, is it not? Why does it need fully qualified field names to reference fields in the same table? Ah, that was from data viewer. Your calculation has been implemented and it is perfect and I can proceed!
comment Posted February 7, 2015 Posted February 7, 2015 Good. BTW, you could also do it this way = Let ( trigger = Extend ( gTrigger ) ; Extend ( Choose ( Get ( CalculationRepetitionNumber ) - 1 ; Icon_add ; Icon_delete ; Icon_edit ) ) ) but then repetitions #4 and higher will error out, trying to extend a non-existing field.
Recommended Posts
This topic is 3634 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now