Hi. I think this is a basic question but I’m stoped because of this: I have 31 fields (one for each day of month) and I have to work with one of them (depending of the users choice).
Hoy do I call the field, if I have the day number in a variable?
Example: Fields are {d1}, {d2}, {d3}, {d4}, etc. And I have a variable [glo_dia]. How do I construct the number of the fileld? I’ve tried thing like “{”.[glo_dia]."}" but it doesn’t work.
Thank you a lot
Prof. Sergio Rassino
Hi Sergio,
Is this in an event, and what type of app?
If you are trying to detect and use the value then try this type of logic in an event like onLoad, where the field values are available to you.
if ([glo_dia] == 1)
{
$myvaluefromday = {d1};
}
elseif ([glo_dia] == 2)
{
$myvaluefromday = {d2};
}
…
If I am not understanding youcorrect and you mean how to set a value in an event, try something like:
{d1} = [glo_dia];
You basically have 3 types of variables in SC.
local start with a $ $alocalvar
global are in brackets [someglobal]
fields from your database OR fields you added that are not in DB {field1}
As a tip, on your global, make sure you go to applications - globals and set the IN or OUT. If it is originating from the current app, to be used internally in another event then use OUT
If it is being passed into and only used by the current app, set as IN
I hope that helps,
Jamie
Thank you Jamie: I could solve the problem with your suggestion. I thought it could exist something like other lenguages, but your explanation was grate.
It is wonderfull to have such an active scriptcase comunity.
Sergio